mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: do not try to refresh token on session expiry
This commit is contained in:
@@ -20,7 +20,7 @@ function maskEmail(email) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function SessionExpiredDialog(props) {
|
function SessionExpiredDialog(props) {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const { onClose, email } = props;
|
const { onClose, email } = props;
|
||||||
const [error, setError] = useState();
|
const [error, setError] = useState();
|
||||||
@@ -30,18 +30,7 @@ function SessionExpiredDialog(props) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isAppLoaded) return;
|
if (!isAppLoaded) return;
|
||||||
|
setIsLoading(false);
|
||||||
(async () => {
|
|
||||||
setIsLoading(true);
|
|
||||||
try {
|
|
||||||
const token = await db.user.tokenManager.getToken();
|
|
||||||
if (token) onClose(true);
|
|
||||||
} catch (e) {
|
|
||||||
setError(`Could not refresh access_token. Error: ${e.message}`);
|
|
||||||
} finally {
|
|
||||||
setIsLoading(false);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}, [onClose, isAppLoaded]);
|
}, [onClose, isAppLoaded]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -75,7 +64,7 @@ function SessionExpiredDialog(props) {
|
|||||||
form: "loginForm",
|
form: "loginForm",
|
||||||
type: "submit",
|
type: "submit",
|
||||||
},
|
},
|
||||||
text: "Sign in",
|
text: "Refresh session",
|
||||||
loading: isLoggingIn || isLoading,
|
loading: isLoggingIn || isLoading,
|
||||||
disabled: isLoggingIn || isLoading,
|
disabled: isLoggingIn || isLoading,
|
||||||
}}
|
}}
|
||||||
@@ -104,10 +93,10 @@ function SessionExpiredDialog(props) {
|
|||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
>
|
>
|
||||||
<Field
|
<Field
|
||||||
required
|
id="disabled"
|
||||||
id="email"
|
|
||||||
label="Email"
|
label="Email"
|
||||||
name="email-disabled"
|
name="disabled"
|
||||||
|
autoComplete="disabled"
|
||||||
defaultValue={maskEmail(email)}
|
defaultValue={maskEmail(email)}
|
||||||
disabled={!!email}
|
disabled={!!email}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user