mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 05:28:51 +00:00
ref(frontend): update to absolute import
This commit is contained in:
@@ -1,29 +1,27 @@
|
||||
import token from "../../pages/api/auth/Token"
|
||||
import { PATH } from '../../const';
|
||||
import token from "~/pages/api/auth/Token";
|
||||
import { PATH } from "../../const";
|
||||
|
||||
export default class SecurityClient {
|
||||
static authOrigins = [PATH]
|
||||
static #token = '';
|
||||
static authOrigins = [PATH];
|
||||
static #token = "";
|
||||
|
||||
contructor() {
|
||||
contructor() {}
|
||||
|
||||
}
|
||||
static setToken(token) {
|
||||
this.#token = token;
|
||||
}
|
||||
|
||||
static setToken(token) {
|
||||
this.#token = token;
|
||||
}
|
||||
static async fetchCall(resource, options) {
|
||||
let req = new Request(resource, options);
|
||||
const destOrigin = new URL(req.url).origin;
|
||||
|
||||
static async fetchCall(resource, options) {
|
||||
let req = new Request(resource, options);
|
||||
const destOrigin = new URL(req.url).origin;
|
||||
if (this.#token == "") {
|
||||
this.setToken(await token());
|
||||
}
|
||||
|
||||
if (this.#token == "") {
|
||||
this.setToken(await token())
|
||||
}
|
||||
|
||||
if (this.#token && this.authOrigins.includes(destOrigin)) {
|
||||
req.headers.set('Authorization', "Bearer " + this.#token);
|
||||
return fetch(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.#token && this.authOrigins.includes(destOrigin)) {
|
||||
req.headers.set("Authorization", "Bearer " + this.#token);
|
||||
return fetch(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user