Socialify

Folder ..

Viewing errors.ts
23 lines (24 loc) • 1.5 KB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export const getFirebaseErrorMessage = (error: string): string => {
    switch (error) {
        case "auth/too-many-requests":
            return "Access to this account has been temporarily disabled due to many failed login attempts. You can immediately restore it by resetting your password or you can try again later."
        case "auth/email-already-exists":
            return "The email address is already in use. Please try registering with a different email address."
        case "auth/invalid-email":
            return "The email address is not valid. Please enter a valid email address."
        case "auth/session-cookie-revoked":
            return "The session cookie has been revoked. Please try logging in again."
        case "auth/session-cookie-expired":
            return "The session cookie has expired. Please try logging in again."
        case "auth/invalid-photo-url":
            return "The photo URL is not valid. Please enter a valid URL."
        case "auth/user-not-found":
            return "The user does not exist. Please try again."
        case "auth/invalid-login-credentials":
            return "The requested user account/password is either invalid or does not exist. Please check your credentials and try again."
        case "auth/invalid-credential":
            return "The requested credential is either invalid or does not exist. Please check your credentials and try again."
        default:
            return "An error occurred. Please try again later.";
    }
}