diff --git a/src/api/api.ts b/src/api/api.ts index 24c8ae4..e40c71b 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -330,7 +330,7 @@ export class ApiHandler { let finalUrl = options.url; let data: string | FormData | undefined; if (options.request.auth) { - options.headers.Authorization = `${this.options.type} ${this.options.token}`; + options.headers.Authorization = `${this.options.type} ${options.request.token || this.options.token}`; } if (options.request.query) { finalUrl += `?${new URLSearchParams(options.request.query)}`; diff --git a/src/api/shared.ts b/src/api/shared.ts index d1221b9..198448a 100644 --- a/src/api/shared.ts +++ b/src/api/shared.ts @@ -36,6 +36,7 @@ export interface ApiRequestOptions { route?: `/${string}`; unshift?: boolean; appendToFormData?: boolean; + token?: string; } export type HttpMethods = 'GET' | 'DELETE' | 'PUT' | 'POST' | 'PATCH';