mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
v4.5.1 (#417)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { GET, POST, DELETE } from '@/web/common/api/request';
|
||||
import type { EditApiKeyProps, GetApiKeyProps } from '@/global/support/api/openapiReq.d';
|
||||
import type { OpenApiSchema } from '@fastgpt/support/openapi/type.d';
|
||||
import type { OpenApiSchema } from '@fastgpt/global/support/openapi/type';
|
||||
|
||||
/**
|
||||
* crete a api key
|
@@ -1,6 +1,6 @@
|
||||
import { GET, POST, DELETE } from '@/web/common/api/request';
|
||||
import type { InitShareChatResponse } from '@/global/support/api/outLinkRes.d';
|
||||
import type { OutLinkEditType, OutLinkSchema } from '@fastgpt/support/outLink/type.d';
|
||||
import type { OutLinkEditType, OutLinkSchema } from '@fastgpt/global/support/outLink/type.d';
|
||||
|
||||
/**
|
||||
* 初始化分享聊天
|
@@ -1,5 +1,5 @@
|
||||
import { GET, POST, PUT } from '@/web/common/api/request';
|
||||
import { hashStr } from '@fastgpt/common/tools/str';
|
||||
import { hashStr } from '@fastgpt/global/common/string/tools';
|
||||
import type { ResLogin, PromotionRecordType } from '@/global/support/api/userRes.d';
|
||||
import { UserAuthTypeEnum } from '@/constants/common';
|
||||
import { UserType, UserUpdateParams } from '@/types/user';
|
18
projects/app/src/web/support/user/auth.ts
Normal file
18
projects/app/src/web/support/user/auth.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { loginOut } from '@/web/support/user/api';
|
||||
|
||||
const tokenKey = 'token';
|
||||
export const clearToken = () => {
|
||||
try {
|
||||
loginOut();
|
||||
localStorage.removeItem(tokenKey);
|
||||
} catch (error) {
|
||||
error;
|
||||
}
|
||||
};
|
||||
|
||||
export const setToken = (token: string) => {
|
||||
localStorage.setItem(tokenKey, token);
|
||||
};
|
||||
export const getToken = () => {
|
||||
return localStorage.getItem(tokenKey) || '';
|
||||
};
|
@@ -1,9 +1,9 @@
|
||||
import { useState, useMemo, useCallback } from 'react';
|
||||
import { sendAuthCode } from '@/web/support/api/user';
|
||||
import { sendAuthCode } from '@/web/support/user/api';
|
||||
import { UserAuthTypeEnum } from '@/constants/common';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { feConfigs } from '@/web/common/store/static';
|
||||
import { getErrText } from '@/utils/tools';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
|
||||
let timer: any;
|
||||
|
@@ -2,9 +2,9 @@ import { create } from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
import type { UserType, UserUpdateParams } from '@/types/user';
|
||||
import { getMyModels, getModelById, putAppById } from '@/web/core/api/app';
|
||||
import { formatPrice } from '@fastgpt/common/bill/index';
|
||||
import { getTokenLogin, putUserInfo } from '@/web/support/api/user';
|
||||
import { getMyModels, getModelById, putAppById } from '@/web/core/app/api';
|
||||
import { formatPrice } from '@fastgpt/global/common/bill/tools';
|
||||
import { getTokenLogin, putUserInfo } from '@/web/support/user/api';
|
||||
import { defaultApp } from '@/constants/model';
|
||||
import { AppListItemType, AppUpdateParams } from '@/types/app';
|
||||
|
Reference in New Issue
Block a user