From a28f730a1180b24a5d28361ebebeaafed1711403 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 14 Jan 2024 18:57:32 -0600 Subject: [PATCH] Add additional sign-in logging --- src/auth/actions.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/auth/actions.ts b/src/auth/actions.ts index 94c8d430..b52c7f55 100644 --- a/src/auth/actions.ts +++ b/src/auth/actions.ts @@ -16,14 +16,19 @@ export const signInAction = async ( try { await signIn('credentials', Object.fromEntries(formData)); } catch (error) { + console.log('signInAction error: string', `${error}`); + console.log('signInAction error: object', error); if (`${error}`.includes(KEY_CREDENTIALS_SIGN_IN_ERROR)) { + console.log('signInAction: 01'); // Rethrow credentials error to display on the sign in page. return KEY_CREDENTIALS_SIGN_IN_ERROR; } else if (!`${error}`.includes('NEXT_REDIRECT')) { + console.log('signInAction: 02'); // Rethrow non-redirect errors throw error; } } + console.log('signInAction: 03'); redirect(formData.get(KEY_CALLBACK_URL) as string || PATH_ADMIN_PHOTOS); };