96 switch from azure table storage to sqlite (#97)
* adding typeorm to api * switching to sqlite * switching to sqlite * switching to sqlite * migrating to sqlite * updating terraform * updating infrastructure
This commit was merged in pull request #97.
This commit is contained in:
25
client/src/httpClient/httpClient.ts
Normal file
25
client/src/httpClient/httpClient.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import axios, { AxiosInstance, CreateAxiosDefaults } from 'axios';
|
||||
import { getOidc } from '../auth/oidcConfig';
|
||||
|
||||
let config: CreateAxiosDefaults<any> = {
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
|
||||
const httpClient: AxiosInstance = axios.create(config)
|
||||
|
||||
httpClient.interceptors.request.use(async (config) => {
|
||||
const oidc = await getOidc();
|
||||
|
||||
if (oidc.isUserLoggedIn) {
|
||||
const { accessToken } = await oidc.getTokens();
|
||||
|
||||
config.headers.Authorization = `Bearer ${accessToken}`;
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
|
||||
export default httpClient;
|
||||
Reference in New Issue
Block a user