|
@@ -1,11 +1,11 @@
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
import { kebabCase } from 'lodash-es';
|
|
import { kebabCase } from 'lodash-es';
|
|
|
|
|
|
-import { useUserInfoStore } from '@/stores/user-info';
|
|
|
|
|
|
+// import { useUserInfoStore } from '@/stores/user-info';
|
|
import { t } from '@/i18n';
|
|
import { t } from '@/i18n';
|
|
import { fileContentTypeRegExp, TimeScaleType } from '@/constants';
|
|
import { fileContentTypeRegExp, TimeScaleType } from '@/constants';
|
|
|
|
|
|
-import { removeToken } from './auth';
|
|
|
|
|
|
+// import { removeToken } from './auth';
|
|
import { fetchWithTimeout } from './fetch';
|
|
import { fetchWithTimeout } from './fetch';
|
|
|
|
|
|
import type { SorterResult } from 'ant-design-vue/es/table/interface';
|
|
import type { SorterResult } from 'ant-design-vue/es/table/interface';
|
|
@@ -19,12 +19,14 @@ export const request = async <T>(url: string, init: RequestInit = {}, timeout?:
|
|
if (typeof init?.body === 'string') {
|
|
if (typeof init?.body === 'string') {
|
|
headers['Content-Type'] = 'application/json;charset=UTF-8';
|
|
headers['Content-Type'] = 'application/json;charset=UTF-8';
|
|
}
|
|
}
|
|
- const { token, resetToken } = useUserInfoStore();
|
|
|
|
- if (token) {
|
|
|
|
- Object.assign(headers, {
|
|
|
|
- Authorization: 'Bearer ' + token,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ // const { token, resetToken } = useUserInfoStore();
|
|
|
|
+ // if (token) {
|
|
|
|
+ // Object.assign(headers, {
|
|
|
|
+ // Authorization: 'Bearer ' + token,
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ headers['Authorization'] = 'Bearer ' + import.meta.env.VITE_TEMP_TOKEN;
|
|
|
|
|
|
Object.assign(headers, init?.headers);
|
|
Object.assign(headers, init?.headers);
|
|
|
|
|
|
@@ -38,9 +40,9 @@ export const request = async <T>(url: string, init: RequestInit = {}, timeout?:
|
|
);
|
|
);
|
|
|
|
|
|
if (res.status === 401) {
|
|
if (res.status === 401) {
|
|
- removeToken();
|
|
|
|
- resetToken();
|
|
|
|
- location.replace('/login');
|
|
|
|
|
|
+ // removeToken();
|
|
|
|
+ // resetToken();
|
|
|
|
+ // location.replace('/login');
|
|
throw new Error(t('common.reLogin'));
|
|
throw new Error(t('common.reLogin'));
|
|
}
|
|
}
|
|
|
|
|