Revert "sub plan page (#885)" (#886)

This reverts commit 443ad37b6a.
This commit is contained in:
Archer
2024-02-23 17:48:15 +08:00
committed by GitHub
parent 443ad37b6a
commit fd9b6291af
246 changed files with 4281 additions and 6286 deletions

View File

@@ -3,17 +3,14 @@ import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
import type { UserUpdateParams } from '@/types/user';
import type { UserType } from '@fastgpt/global/support/user/type.d';
import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/bill/tools';
import { getTokenLogin, putUserInfo } from '@/web/support/user/api';
import { FeTeamPlanStatusType } from '@fastgpt/global/support/wallet/sub/type';
import { getTeamPlanStatus } from '@/web/support/wallet/sub/api';
type State = {
userInfo: UserType | null;
initUserInfo: () => Promise<UserType>;
setUserInfo: (user: UserType | null) => void;
updateUserInfo: (user: UserUpdateParams) => Promise<void>;
teamPlanStatus: FeTeamPlanStatusType | null;
initTeamPlanStatus: () => Promise<any>;
};
export const useUserStore = create<State>()(
@@ -22,22 +19,19 @@ export const useUserStore = create<State>()(
immer((set, get) => ({
userInfo: null,
async initUserInfo() {
get().initTeamPlanStatus();
const res = await getTokenLogin();
get().setUserInfo(res);
//设置html的fontsize
const html = document?.querySelector('html');
if (html) {
// html.style.fontSize = '16px';
}
return res;
},
setUserInfo(user: UserType | null) {
set((state) => {
state.userInfo = user ? user : null;
state.userInfo = user
? {
...user,
balance: formatStorePrice2Read(user.balance)
}
: null;
});
},
async updateUserInfo(user: UserUpdateParams) {
@@ -57,15 +51,6 @@ export const useUserStore = create<State>()(
});
return Promise.reject(error);
}
},
teamPlanStatus: null,
initTeamPlanStatus() {
return getTeamPlanStatus().then((res) => {
set((state) => {
state.teamPlanStatus = res;
});
return res;
});
}
})),
{