Create toast provider

This commit is contained in:
Takeshi Kimata
2024-05-29 21:34:59 +09:00
parent cfd6a9b339
commit 4b46944440
3 changed files with 13 additions and 4 deletions

View File

@@ -111,12 +111,12 @@ const TokenProvider = ({ toastMessages, locale, children }: TokenProps) => {
}
if (isPrivatePath(pathname) && !isSignedIn()) {
if (tokenExists()) {
toastContext.showToast(toastMessages.needSignedIn, 'default');
toastContext.showToast(toastMessages.needSignedIn, 'error');
router.push(`/account/signin`, { locale: locale });
return;
}
if (isTokenValid()) {
toastContext.showToast(toastMessages.sessionExpired, 'default');
toastContext.showToast(toastMessages.sessionExpired, 'error');
router.push(`/account/signin`, { locale: locale });
return;
}