chore: auth error handling

This commit is contained in:
gurusainath 2024-04-29 23:12:43 +05:30
parent 56e99937bb
commit 4f0b34749c
2 changed files with 54 additions and 1 deletions

View File

@ -44,7 +44,7 @@ export const SignUpView = observer(() => {
<div className="relative">
<PageHead title="Sign Up" />
<div className="absolute inset-0 z-0">
<Image
<Image
src={resolvedTheme === "dark" ? PlaneBackgroundPatternDark : PlaneBackgroundPattern}
className="w-screen min-h-screen object-cover"
alt="Plane background pattern"

View File

@ -0,0 +1,53 @@
export enum ESignUpEMailCheck {
INSTANCE_NOT_CONFIGURED = "INSTANCE_NOT_CONFIGURED",
USER_ALREADY_EXIST = "USER_ALREADY_EXIST",
}
export enum ESignUp {
INSTANCE_NOT_CONFIGURED = "INSTANCE_NOT_CONFIGURED",
REQUIRED_EMAIL_PASSWORD = "REQUIRED_EMAIL_PASSWORD",
INVALID_EMAIL = "INVALID_EMAIL",
USER_ALREADY_EXIST = "USER_ALREADY_EXIST",
}
export enum ESignInEMailCheck {
INSTANCE_NOT_CONFIGURED = "INSTANCE_NOT_CONFIGURED",
REQUIRED_EMAIL_PASSWORD = "REQUIRED_EMAIL_PASSWORD",
INVALID_EMAIL = "INVALID_EMAIL",
USER_ALREADY_EXIST = "USER_ALREADY_EXIST",
}
export enum ESignIn {
INSTANCE_NOT_CONFIGURED = "INSTANCE_NOT_CONFIGURED",
REQUIRED_EMAIL_PASSWORD = "REQUIRED_EMAIL_PASSWORD",
INVALID_EMAIL = "INVALID_EMAIL",
USER_ALREADY_EXIST = "USER_ALREADY_EXIST",
}
export type TErrorTypes = ESignUpEMailCheck | ESignUp | ESignInEMailCheck | ESignIn;
export enum EErrorAlertType {
BANNER_ALERT = "BANNER_ALERT",
TOAST_ALERT = "TOAST_ALERT",
INLINE_FIRST_NAME = "INLINE_FIRST_NAME",
INLINE_EMAIL = "INLINE_EMAIL",
INLINE_PASSWORD = "INLINE_PASSWORD",
}
export const errorHandler = (
errorType: TErrorTypes,
errorMessage: string | undefined
): { type: EErrorAlertType | undefined; message: string | undefined } => {
const errorPayload = {
type: undefined,
message: errorMessage || undefined,
};
const signUpErrorTypes = [""];
const signInErrorTypes = [""];
console.log("errorType", errorType);
console.log("signUpErrorTypes", signUpErrorTypes);
console.log("signInErrorTypes", signInErrorTypes);
return errorPayload;
};