mirror of
https://github.com/r-ca/kidshift-skills.git
synced 2024-10-26 01:24:03 +00:00
api client実装WIP
This commit is contained in:
parent
1a2d8690ae
commit
6724d9b37c
27
src/api.ts
Normal file
27
src/api.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
|
||||
// Const
|
||||
const BASE_URL = 'https://kidshift-beta.nem.one';
|
||||
const TIMEOUT = 5000;
|
||||
|
||||
class ApiClient {
|
||||
private client: AxiosInstance;
|
||||
|
||||
constructor() {
|
||||
this.client = axios.create({
|
||||
baseURL: BASE_URL,
|
||||
timeout: TIMEOUT,
|
||||
});
|
||||
}
|
||||
|
||||
private getHeaders(includeToken: boolean): Record<string, string> {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
if (includeToken) {
|
||||
const token = 'placeholder_token';
|
||||
headers['Authorization'] = `Bearer ${token}`;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user