mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26: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 finalUrl = options.url;
|
||||||
let data: string | FormData | undefined;
|
let data: string | FormData | undefined;
|
||||||
if (options.request.auth) {
|
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) {
|
if (options.request.query) {
|
||||||
finalUrl += `?${new URLSearchParams(options.request.query)}`;
|
finalUrl += `?${new URLSearchParams(options.request.query)}`;
|
||||||
|
@ -36,6 +36,7 @@ export interface ApiRequestOptions {
|
|||||||
route?: `/${string}`;
|
route?: `/${string}`;
|
||||||
unshift?: boolean;
|
unshift?: boolean;
|
||||||
appendToFormData?: boolean;
|
appendToFormData?: boolean;
|
||||||
|
token?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type HttpMethods = 'GET' | 'DELETE' | 'PUT' | 'POST' | 'PATCH';
|
export type HttpMethods = 'GET' | 'DELETE' | 'PUT' | 'POST' | 'PATCH';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user