Feat/api jwt (#1212)
This commit is contained in:
@@ -179,6 +179,10 @@ const baseFetch = <T>(
|
||||
}
|
||||
options.headers.set('Authorization', `Bearer ${accessTokenJson[sharedToken]}`)
|
||||
}
|
||||
else {
|
||||
const accessToken = localStorage.getItem('console_token') || ''
|
||||
options.headers.set('Authorization', `Bearer ${accessToken}`)
|
||||
}
|
||||
|
||||
if (deleteContentType) {
|
||||
options.headers.delete('Content-Type')
|
||||
@@ -292,7 +296,9 @@ export const upload = (options: any): Promise<any> => {
|
||||
const defaultOptions = {
|
||||
method: 'POST',
|
||||
url: `${API_PREFIX}/files/upload`,
|
||||
headers: {},
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem('console_token') || ''}`,
|
||||
},
|
||||
data: {},
|
||||
}
|
||||
options = {
|
||||
|
@@ -15,8 +15,8 @@ import type {
|
||||
} from '@/models/app'
|
||||
import type { BackendModel, ProviderMap } from '@/app/components/header/account-setting/model-page/declarations'
|
||||
|
||||
export const login: Fetcher<CommonResponse, { url: string; body: Record<string, any> }> = ({ url, body }) => {
|
||||
return post<CommonResponse>(url, { body })
|
||||
export const login: Fetcher<CommonResponse & { data: string }, { url: string; body: Record<string, any> }> = ({ url, body }) => {
|
||||
return post(url, { body }) as Promise<CommonResponse & { data: string }>
|
||||
}
|
||||
|
||||
export const setup: Fetcher<CommonResponse, { body: Record<string, any> }> = ({ body }) => {
|
||||
|
Reference in New Issue
Block a user