현금영수증 리스트
This commit is contained in:
@@ -18,8 +18,10 @@ import { useStore } from '@/shared/model/store';
|
||||
import { getLocalStorage, setLocalStorage } from '@/shared/lib';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
import { HomeGroupsParams, HomeGroupsResponse } from '@/entities/home/model/types';
|
||||
import { LoginResponse } from '@/entities/user/model/types';
|
||||
import { LoginResponse, ShortcutUserParams, ShortcutUserResponse } from '@/entities/user/model/types';
|
||||
import { useCodesListByCodeClMutation } from '@/entities/common/api/use-codes-list-by-codeCl-mutaion';
|
||||
import { useShortcutUserMutation } from '@/entities/user/api/use-shortcut-user-mutation';
|
||||
import { useShortcutDefaultMutation } from '@/entities/user/api/use-shortcut-detault-mutation';
|
||||
|
||||
export interface ContextType {
|
||||
setOnBack: (onBack: () => void) => void;
|
||||
@@ -58,7 +60,8 @@ export const SubLayout = () => {
|
||||
const { isNativeEnvironment } = useAppBridge();
|
||||
const { mutateAsync: homeGroups } = useHomeGroupsMutation();
|
||||
const { mutateAsync: codesListByCodeCl} = useCodesListByCodeClMutation();
|
||||
|
||||
const { mutateAsync: shortcutUser } = useShortcutUserMutation();
|
||||
const { mutateAsync: shortcutDefault } = useShortcutDefaultMutation();
|
||||
|
||||
const wrapperClassName = 'wrapper';
|
||||
|
||||
@@ -91,6 +94,39 @@ export const SubLayout = () => {
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
const callSortcutDefault = () => {
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
if(userInfo.usrid){
|
||||
let params: ShortcutUserParams = {
|
||||
usrid: userInfo.usrid
|
||||
};
|
||||
shortcutUser(params).then((rs: ShortcutUserResponse) => {
|
||||
useStore.getState().UserStore.setUserFavorite(rs.shortcuts);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const callShortcutUser = () => {
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
if(userInfo.usrid){
|
||||
let params: ShortcutUserParams = {
|
||||
usrid: userInfo.usrid
|
||||
};
|
||||
shortcutUser(params).then((rs: ShortcutUserResponse) => {
|
||||
if(rs.shortcuts){
|
||||
if(rs.shortcuts.length > 0){
|
||||
useStore.getState().UserStore.setUserFavorite(rs.shortcuts);
|
||||
}
|
||||
else{
|
||||
callSortcutDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const handleLogin = useCallback(async () => {
|
||||
let userParmas;
|
||||
@@ -102,6 +138,7 @@ export const SubLayout = () => {
|
||||
}
|
||||
callLogin(userParmas).then(() => {
|
||||
callHomeGroups();
|
||||
callShortcutUser();
|
||||
}).catch((error: any) => {
|
||||
setLoginSuccess(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user