Fix typescript issues (#7640)

This commit is contained in:
Nicola Krumschmidt
2021-08-26 23:59:12 +02:00
committed by GitHub
parent 10ce9751e7
commit fe882fd407
2 changed files with 7 additions and 7 deletions

View File

@@ -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 });
}

View File

@@ -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();
}
}
);