수정
This commit is contained in:
@@ -7,14 +7,19 @@ import { Dialog, DialogProps } from '@/shared/ui/dialogs/dialog';
|
||||
type CommonErrorProps = FallbackProps & {
|
||||
height?: number;
|
||||
};
|
||||
export const APIError = ({ error, resetErrorBoundary }: CommonErrorProps) => {
|
||||
export const APIError = ({
|
||||
error,
|
||||
resetErrorBoundary
|
||||
}: CommonErrorProps) => {
|
||||
console.log('APIError --> ', error);
|
||||
|
||||
const { navigateBack } = useNavigate();
|
||||
const msg = useMemo(() => {
|
||||
let message: Partial<DialogProps> = {
|
||||
title: '일시적인 오류가 발생하였습니다.',
|
||||
message: '잠시 후 다시 시도해주세요.',
|
||||
};
|
||||
if (error?.response?.data?.message) {
|
||||
if(error?.response?.data?.message){
|
||||
message = { message: error.response.data.message };
|
||||
}
|
||||
return message;
|
||||
@@ -27,13 +32,13 @@ export const APIError = ({ error, resetErrorBoundary }: CommonErrorProps) => {
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
afterLeave={() => null}
|
||||
open={true}
|
||||
onClose={() => null}
|
||||
afterLeave={ () => null }
|
||||
open={ true }
|
||||
onClose={ () => null }
|
||||
onConfirmClick={ resetErrorBoundary }
|
||||
onCancelClick={ handleCancel }
|
||||
message={msg.message}
|
||||
buttonLabel={['취소', '재시도']}
|
||||
message={ msg.message }
|
||||
buttonLabel={ ['취소', '재시도'] }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -6,30 +6,35 @@ import { Dialog, DialogProps } from '@/shared/ui/dialogs/dialog';
|
||||
type CommonErrorProps = FallbackProps & {
|
||||
height?: number;
|
||||
};
|
||||
export const CommonError = ({ error, resetErrorBoundary }: CommonErrorProps) => {
|
||||
export const CommonError = ({
|
||||
error,
|
||||
resetErrorBoundary
|
||||
}: CommonErrorProps) => {
|
||||
console.log('CommonError --> ', error);
|
||||
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
const msg = useMemo(() => {
|
||||
let message: Partial<DialogProps> = {
|
||||
title: '일시적인 오류가 발생하였습니다.',
|
||||
message: '잠시 후 다시 시도해주세요.',
|
||||
message: '잠시 후 다시 시도해주세요.'
|
||||
};
|
||||
if (error?.response?.data?.message) {
|
||||
if(error?.response?.data?.message){
|
||||
message = { message: error.response.data.message };
|
||||
}
|
||||
return message;
|
||||
return message;
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
afterLeave={() => null}
|
||||
open={isOpen}
|
||||
onClose={() => setIsOpen(false)}
|
||||
onConfirmClick={resetErrorBoundary}
|
||||
afterLeave={ () => null }
|
||||
open={ isOpen }
|
||||
onClose={ () => setIsOpen(false) }
|
||||
onConfirmClick={ resetErrorBoundary }
|
||||
onCancelClick={() => {
|
||||
location.href = '/';
|
||||
}}
|
||||
message={msg.message}
|
||||
buttonLabel={['취소', '재시도']}
|
||||
message={ msg.message }
|
||||
buttonLabel={ ['취소', '재시도'] }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,10 @@ import { useEffect, useMemo } from 'react';
|
||||
import { NiceAxiosFallbackProps } from '@/shared/@types/error';
|
||||
import { Dialog, DialogProps } from '@/shared/ui/dialogs/dialog';
|
||||
|
||||
export const KickOutError = ({ error, resetErrorBoundary }: NiceAxiosFallbackProps) => {
|
||||
export const KickOutError = ({
|
||||
error,
|
||||
resetErrorBoundary
|
||||
}: NiceAxiosFallbackProps) => {
|
||||
useEffect(() => {
|
||||
console.error('[ErrorBoundary] Kickout Error', JSON.stringify(error.response?.data));
|
||||
// clearAuthData();
|
||||
@@ -14,8 +17,10 @@ export const KickOutError = ({ error, resetErrorBoundary }: NiceAxiosFallbackPro
|
||||
title: '일시적인 오류가 발생하였습니다.',
|
||||
message: '잠시 후 다시 시도해주세요.',
|
||||
};
|
||||
if (error?.response?.data?.message) {
|
||||
message = { message: error.response.data.message };
|
||||
if(error?.response?.data?.message){
|
||||
message = {
|
||||
message: error.response.data.message
|
||||
};
|
||||
}
|
||||
return message;
|
||||
}, [error]);
|
||||
@@ -23,7 +28,7 @@ export const KickOutError = ({ error, resetErrorBoundary }: NiceAxiosFallbackPro
|
||||
const handleCancel = () => {
|
||||
resetErrorBoundary?.();
|
||||
};
|
||||
|
||||
|
||||
const handleConfirm = () => {
|
||||
resetErrorBoundary?.();
|
||||
// kickOut();
|
||||
@@ -31,12 +36,13 @@ export const KickOutError = ({ error, resetErrorBoundary }: NiceAxiosFallbackPro
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
afterLeave={() => null}
|
||||
open={true}
|
||||
onClose={() => null}
|
||||
onConfirmClick={handleConfirm}
|
||||
onCancelClick={handleCancel}
|
||||
message={msg.message}
|
||||
afterLeave={ () => null }
|
||||
open={ true }
|
||||
onClose={ () => null }
|
||||
onConfirmClick={ handleConfirm }
|
||||
onCancelClick={ handleCancel }
|
||||
message={ msg.message }
|
||||
buttonLabel={ ['취소', '재시도'] }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user