mirror of
https://github.com/directus/directus.git
synced 2026-02-11 18:24:56 -05:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user