mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 20:55:42 +00:00
fix: use axios error instead of generic error in login page
This commit is contained in:
@@ -49,5 +49,5 @@
|
||||
"forgotPasswordTitle": "Forgot your password?",
|
||||
"failedToFetchProvidersTitle": "Failed to load authentication providers. Please check your configuration.",
|
||||
"errorTitle": "An error occurred",
|
||||
"errorSubtitle": "An error occured while trying to perform this action. Please check the console for more information."
|
||||
"errorSubtitle": "An error occurred while trying to perform this action. Please check the console for more information."
|
||||
}
|
||||
@@ -49,5 +49,5 @@
|
||||
"forgotPasswordTitle": "Forgot your password?",
|
||||
"failedToFetchProvidersTitle": "Failed to load authentication providers. Please check your configuration.",
|
||||
"errorTitle": "An error occurred",
|
||||
"errorSubtitle": "An error occured while trying to perform this action. Please check the console for more information."
|
||||
"errorSubtitle": "An error occurred while trying to perform this action. Please check the console for more information."
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import { useUserContext } from "@/context/user-context";
|
||||
import { useIsMounted } from "@/lib/hooks/use-is-mounted";
|
||||
import { LoginSchema } from "@/schemas/login-schema";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
import axios, { AxiosError } from "axios";
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Navigate, useLocation } from "react-router";
|
||||
@@ -85,11 +85,12 @@ export const LoginPage = () => {
|
||||
);
|
||||
}, 500);
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
onError: (error: AxiosError) => {
|
||||
toast.error(t("loginFailTitle"), {
|
||||
description: error.message.includes("429")
|
||||
? t("loginFailRateLimit")
|
||||
: t("loginFailSubtitle"),
|
||||
description:
|
||||
error.response?.status === 429
|
||||
? t("loginFailRateLimit")
|
||||
: t("loginFailSubtitle"),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user