Switch to history mode in app (#594)

* Switch to history mode in pp

* Remove broken tests

* Install asset manifest

* Only build to modern

* Remove override files in favor of settings

* Build assets json

* Use dynamic routing based on api basepath

* Remove override files

* Set webpack public path based on passed window var

* Fix tests
This commit is contained in:
Rijk van Zanten
2020-05-19 17:16:44 -04:00
committed by GitHub
parent c552364d1f
commit 0c745a6eee
15 changed files with 96 additions and 122 deletions

View File

@@ -1,6 +1,7 @@
import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios';
import { useRequestsStore } from '@/stores/requests';
import { LogoutReason, logout, checkAuth } from '@/auth';
import getRootPath from '@/utils/get-root-path';
const api = axios.create({
baseURL: getRootPath(),
@@ -65,12 +66,4 @@ export const onError = async (error: RequestError) => {
api.interceptors.request.use(onRequest);
api.interceptors.response.use(onResponse, onError);
export function getRootPath(): string {
const path = window.location.pathname;
const parts = path.split('/');
const adminIndex = parts.indexOf('admin');
const rootPath = parts.slice(0, adminIndex).join('/') + '/';
return rootPath;
}
export default api;