shortcut default bug fix
This commit is contained in:
@@ -255,6 +255,7 @@ export interface ShortcutSaveResponse {
|
||||
};
|
||||
export interface ShortcutUserParams {
|
||||
usrid: string;
|
||||
subUserLevel?: string;
|
||||
};
|
||||
export interface ShortcutUserResponse {
|
||||
shortcuts: Array<Shortcuts>;
|
||||
|
||||
@@ -21,10 +21,15 @@ import { useHomeGroupsMutation } from '@/entities/home/api/use-home-groups-mutat
|
||||
import { useUserInfo } from '@/entities/user/lib/use-user-info';
|
||||
import { useAppBridge } from '@/hooks';
|
||||
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 { BusinessPropertyParams, BusinessPropertyResponse, LoginResponse, ShortcutUserParams, ShortcutUserResponse, UserFindAuthMethodParams, UserFindAuthMethodResponse } from '@/entities/user/model/types';
|
||||
import {
|
||||
BusinessPropertyParams,
|
||||
BusinessPropertyResponse,
|
||||
LoginResponse,
|
||||
ShortcutUserParams,
|
||||
ShortcutUserResponse,
|
||||
UserFindAuthMethodParams
|
||||
} from '@/entities/user/model/types';
|
||||
import { useShortcutUserMutation } from '@/entities/user/api/use-shortcut-user-mutation';
|
||||
import { useShortcutDefaultMutation } from '@/entities/user/api/use-shortcut-detault-mutation';
|
||||
import { useBusinessPropertyMutation } from '@/entities/user/api/use-business-property-mutation';
|
||||
@@ -111,7 +116,6 @@ export const SubLayout = () => {
|
||||
let last = value.value.slice(-1);
|
||||
return last.toLowerCase() !== 'g';
|
||||
});
|
||||
console.log(options)
|
||||
useStore.getState().UserStore.setSelectOptionsMidsWithoutGids(optionsWithoutGids);
|
||||
|
||||
setLoginSuccess(true);
|
||||
@@ -134,17 +138,18 @@ export const SubLayout = () => {
|
||||
};
|
||||
|
||||
const callSortcutDefault = () => {
|
||||
console.log("============================callSortcutDefault")
|
||||
console.log('callSortcutDefault')
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
if(userInfo.usrid){
|
||||
let params: ShortcutUserParams = {
|
||||
usrid: userInfo.usrid
|
||||
usrid: userInfo.usrid,
|
||||
subUserLevel: 'MANAGER'
|
||||
};
|
||||
shortcutUser(params).then((rs: ShortcutUserResponse) => {
|
||||
// Modify iconFilePath to use menu_icon_{menuId}.svg format
|
||||
shortcutDefault(params).then((rs: ShortcutUserResponse) => {
|
||||
const modifiedShortcuts = rs.shortcuts.map(shortcut => ({
|
||||
...shortcut,
|
||||
iconFilePath: `menu_icon_${shortcut.menuId}.svg`
|
||||
iconFilePath: `/images/menu_icon_${shortcut.menuId}.svg`,
|
||||
programPath: getProgramPath(shortcut.menuId)
|
||||
}));
|
||||
|
||||
useStore.getState().UserStore.setUserFavorite(modifiedShortcuts);
|
||||
@@ -178,14 +183,12 @@ export const SubLayout = () => {
|
||||
};
|
||||
|
||||
const callShortcutUser = () => {
|
||||
console.log("============================callShortcutUser")
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
if(userInfo.usrid){
|
||||
let params: ShortcutUserParams = {
|
||||
usrid: userInfo.usrid
|
||||
};
|
||||
shortcutUser(params).then((rs: ShortcutUserResponse) => {
|
||||
console.log("============================rs", rs)
|
||||
if(!rs.usingDefault && rs.shortcuts){
|
||||
if(rs.shortcuts.length > 0){
|
||||
const modifiedShortcuts = rs.shortcuts.map(shortcut => ({
|
||||
@@ -193,12 +196,9 @@ export const SubLayout = () => {
|
||||
iconFilePath: `/images/menu_icon_${shortcut.menuId}.svg`,
|
||||
programPath: getProgramPath(shortcut.menuId)
|
||||
}));
|
||||
console.log(modifiedShortcuts)
|
||||
|
||||
console.log("============================modifiedShortcuts", modifiedShortcuts)
|
||||
useStore.getState().UserStore.setUserFavorite(modifiedShortcuts);
|
||||
}
|
||||
else{
|
||||
else if(!!rs.usingDefault){
|
||||
callSortcutDefault();
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,7 @@ export const SubLayout = () => {
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if(!!mid){
|
||||
// callBusinessProperty();
|
||||
//callBusinessProperty();
|
||||
callFindAuthMethod();
|
||||
}
|
||||
}, [mid]);
|
||||
|
||||
Reference in New Issue
Block a user