Switched to MPA powered by Razor Pages

After reconsidering where I want to take this project, I realized that a MPA is more fitting.
This commit is contained in:
2021-07-20 19:08:57 -05:00
parent e0756e0967
commit 57f67391f1
141 changed files with 5292 additions and 22079 deletions

View File

@@ -0,0 +1,23 @@
import axios from "axios";
let currentAuthorizationInterceptorID = null;
const apiHttp = axios.create({
baseURL: window.location.origin + "/api",
timeout: 3000,
});
function addBearerTokenInterceptor(token) {
currentAuthorizationInterceptorID = apiHttp.interceptors.request.use((config) => {
config.headers.Authorization = `Bearer ${token}`;
return config;
}, (err) => {
console.error(err);
});
}
function removeBearerTokenInterceptor() {
apiHttp.interceptors.request.eject(currentAuthorizationInterceptorID);
}
export { apiHttp, addBearerTokenInterceptor, removeBearerTokenInterceptor };