fix axios error
This commit is contained in:
parent
1989604370
commit
fba39bec1d
@ -186,7 +186,15 @@ export async function getQuizData({ quizId, status = "" }: { quizId: string; sta
|
||||
const quizDataResponse = response.data;
|
||||
|
||||
if (response.error) {
|
||||
throw response.error;
|
||||
const axiosError = response.error as AxiosError;
|
||||
if (axiosError.response?.data) {
|
||||
throw new Error(
|
||||
typeof axiosError.response.data === "string"
|
||||
? axiosError.response.data
|
||||
: JSON.stringify(axiosError.response.data)
|
||||
);
|
||||
}
|
||||
throw axiosError;
|
||||
}
|
||||
if (!quizDataResponse) {
|
||||
throw new Error("Quiz not found");
|
||||
|
@ -6,7 +6,11 @@ type Props = Partial<FallbackProps>;
|
||||
|
||||
export const ApologyPage = ({ error }: Props) => {
|
||||
let message = error.message || error.response?.data;
|
||||
console.log("message");
|
||||
console.log(message.toLowerCase());
|
||||
const { t } = useTranslation();
|
||||
console.log("t");
|
||||
console.log(t(message.toLowerCase()));
|
||||
|
||||
return (
|
||||
<Box
|
||||
|
Loading…
Reference in New Issue
Block a user