mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 04:56:07 +00:00
feat: overwrite token via request
This commit is contained in:
parent
59b48b2168
commit
7f49385fb1
@ -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)}`;
|
||||
|
@ -36,6 +36,7 @@ export interface ApiRequestOptions {
|
||||
route?: `/${string}`;
|
||||
unshift?: boolean;
|
||||
appendToFormData?: boolean;
|
||||
token?: string;
|
||||
}
|
||||
|
||||
export type HttpMethods = 'GET' | 'DELETE' | 'PUT' | 'POST' | 'PATCH';
|
||||
|
Loading…
x
Reference in New Issue
Block a user