mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix typescript issues (#7640)
This commit is contained in:
committed by
GitHub
parent
10ce9751e7
commit
fe882fd407
@@ -95,13 +95,13 @@ api.interceptors.response.use(onResponse, onError);
|
||||
|
||||
export default api;
|
||||
|
||||
export function getToken(): string {
|
||||
export function getToken(): string | null {
|
||||
return api.defaults.headers?.['Authorization']?.split(' ')[1] || null;
|
||||
}
|
||||
|
||||
export function addTokenToURL(url: string, token?: string): string {
|
||||
token = token || getToken();
|
||||
if (!token) return url;
|
||||
const accessToken = token || getToken();
|
||||
if (!accessToken) return url;
|
||||
|
||||
return addQueryToPath(url, { access_token: token });
|
||||
return addQueryToPath(url, { access_token: accessToken });
|
||||
}
|
||||
|
||||
@@ -164,8 +164,8 @@ export default defineLayout<LayoutOptions, LayoutQuery>({
|
||||
} as Filter;
|
||||
}
|
||||
|
||||
function updateLocationFilter(useTileBBox?: boolean) {
|
||||
const locationFilter = getLocationFilter(useTileBBox);
|
||||
function updateLocationFilter() {
|
||||
const locationFilter = getLocationFilter();
|
||||
locationFilterOutdated.value = false;
|
||||
_filters.value = filters.value.filter((filter) => filter.key !== 'location-filter').concat(locationFilter ?? []);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ export default defineLayout<LayoutOptions, LayoutQuery>({
|
||||
shouldUpdateCamera.value = false;
|
||||
locationFilterOutdated.value = true;
|
||||
if (autoLocationFilter.value) {
|
||||
updateLocationFilter(true);
|
||||
updateLocationFilter();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user