Add auth screens (#193)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { apiBaseUrl, artifactApiBaseUrl, credential } from "@/util/env";
|
||||
import { apiBaseUrl, artifactApiBaseUrl, envCredential } from "@/util/env";
|
||||
import axios from "axios";
|
||||
|
||||
const client = axios.create({
|
||||
baseURL: apiBaseUrl,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-api-key": credential,
|
||||
"x-api-key": envCredential,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -13,4 +13,20 @@ const artifactApiClient = axios.create({
|
||||
baseURL: artifactApiBaseUrl,
|
||||
});
|
||||
|
||||
export function setAuthorizationHeader(token: string) {
|
||||
client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
export function removeAuthorizationHeader() {
|
||||
delete client.defaults.headers.common["Authorization"];
|
||||
}
|
||||
|
||||
export function setApiKeyHeader(apiKey: string) {
|
||||
client.defaults.headers.common["X-API-Key"] = apiKey;
|
||||
}
|
||||
|
||||
export function removeApiKeyHeader() {
|
||||
delete client.defaults.headers.common["X-API-Key"];
|
||||
}
|
||||
|
||||
export { client, artifactApiClient };
|
||||
|
||||
@@ -75,3 +75,7 @@ export type TaskApiResponse = {
|
||||
failure_reason: string | null;
|
||||
errors: unknown[];
|
||||
};
|
||||
|
||||
export type User = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user