불필요 내용 수정및 파일 제거
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import axios from 'axios';
|
||||
import { NiceAxiosError } from '@/shared/@types/error';
|
||||
import { IS_MOCK_PHASE } from '@/shared/constants/environment';
|
||||
|
||||
// CBDCAxiosError가 아니라면 상위 Error Boundary로 위임
|
||||
export const checkIsAxiosError = (error: Error): error is NiceAxiosError => axios.isAxiosError(error);
|
||||
|
||||
export const checkIsKickOutError = (error: NiceAxiosError) => {
|
||||
const status = error.response?.status.toString();
|
||||
return !IS_MOCK_PHASE && (status === '401' || status === '403');
|
||||
return status === '401' || status === '403';
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './use-navigate';
|
||||
export * from './use-fix-scroll-view-safari';
|
||||
export * from './use-navigate';
|
||||
export * from './use-router-listener';
|
||||
export * from './use-keyboard-aware';
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { NativeFunction } from '@/shared/constants/native-function';
|
||||
|
||||
export const useRequestNotification = () => {
|
||||
useEffect(() => {
|
||||
window.webViewBridge.send(NativeFunction.RequestNotification, {
|
||||
success: async () => {
|
||||
// console.log('res', res);
|
||||
},
|
||||
});
|
||||
}, []);
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
import { RouterState } from '@remix-run/router';
|
||||
import { useEffect } from 'react';
|
||||
import { NavigationType } from 'react-router';
|
||||
|
||||
import { router } from '@/shared/configs/router';
|
||||
|
||||
type IRouterListener = (state: RouterState) => void;
|
||||
|
||||
export const useRouterListener = (callback: IRouterListener, actionType?: NavigationType) => {
|
||||
useEffect(() => {
|
||||
const unsubscribe = router.subscribe((state: any) => {
|
||||
if (actionType && state.historyAction !== actionType) return;
|
||||
if (!actionType || state.historyAction === actionType) {
|
||||
callback?.(state);
|
||||
}
|
||||
});
|
||||
|
||||
return unsubscribe;
|
||||
}, [callback, actionType]);
|
||||
};
|
||||
@@ -1,50 +0,0 @@
|
||||
import { overlay } from 'overlay-kit';
|
||||
import { BottomSheet } from '@/shared/ui/bottom-sheets/bottom-sheet';
|
||||
import {
|
||||
SelectTemplate,
|
||||
ElementType,
|
||||
RadioChangeProps,
|
||||
SelectTemplateProps,
|
||||
} from '@/shared/ui/selects/select-template';
|
||||
import { JSX } from 'react/jsx-runtime';
|
||||
|
||||
export interface SelectBottomSheetProps<T> extends SelectTemplateProps<T> {
|
||||
title?: string | JSX.Element;
|
||||
description?: string | JSX.Element;
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
export const useSelectBottomSheet = <T,>() => {
|
||||
const openSelectBottomSheet = (selectBottomSheet: SelectBottomSheetProps<T>) => {
|
||||
const {
|
||||
values = [],
|
||||
labels = [],
|
||||
valueKey = undefined,
|
||||
selectedLabel = '',
|
||||
selectedValue = '',
|
||||
title = '',
|
||||
description = '',
|
||||
} = selectBottomSheet;
|
||||
|
||||
const handleRadioChange = ({ event, label, value }: RadioChangeProps<ElementType<typeof values>>) => {
|
||||
selectBottomSheet?.onRadioChange?.({ event, label, value });
|
||||
};
|
||||
|
||||
overlay.open(({ isOpen, close, unmount }) => {
|
||||
return (
|
||||
<BottomSheet title={title} description={description} afterLeave={unmount} open={isOpen} onClose={close}>
|
||||
<SelectTemplate
|
||||
values={values}
|
||||
valueKey={valueKey}
|
||||
labels={labels}
|
||||
selectedLabel={selectedLabel}
|
||||
selectedValue={selectedValue}
|
||||
onRadioChange={handleRadioChange}
|
||||
/>
|
||||
</BottomSheet>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
return { openSelectBottomSheet, closeBottomSheet: overlay.closeAll };
|
||||
};
|
||||
Reference in New Issue
Block a user