temp
This commit is contained in:
@@ -5,6 +5,9 @@ export type CNBCoreOptions<T = {}> = {
|
||||
*/
|
||||
cookie?: string;
|
||||
cnb?: CNBCore;
|
||||
cors?: {
|
||||
baseUrl?: string
|
||||
}
|
||||
} & T;
|
||||
|
||||
export type RequestOptions = {
|
||||
@@ -19,6 +22,7 @@ export type RequestOptions = {
|
||||
};
|
||||
export class CNBCore {
|
||||
baseURL = 'https://api.cnb.cool';
|
||||
hackURL = 'https://cnb.cool'
|
||||
public token: string;
|
||||
public cookie?: string;
|
||||
constructor(options: CNBCoreOptions) {
|
||||
@@ -32,6 +36,10 @@ export class CNBCore {
|
||||
this.cookie = options.cnb.cookie;
|
||||
}
|
||||
}
|
||||
if (options?.cors?.baseUrl) {
|
||||
this.baseURL = options.cors.baseUrl + '/' + this.baseURL;
|
||||
this.hackURL = options.cors.baseUrl + '/' + this.hackURL;
|
||||
}
|
||||
}
|
||||
|
||||
async request({ url, method = 'GET', data, params, headers, body, useCookie, useOrigin }: RequestOptions): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user