refactor(web): use ImmichApi to create urls (#2435)

This commit is contained in:
Michel Heusschen 2023-05-14 04:52:29 +02:00 committed by GitHub
parent 15fa8250cb
commit 4524aa0d06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 53 additions and 51 deletions

View file

@ -2,19 +2,6 @@ import { AxiosError, AxiosPromise } from 'axios';
import { api } from './api';
import { UserResponseDto } from './open-api';
const _basePath = '/api';
export function getFileUrl(assetId: string, isThumb?: boolean, isWeb?: boolean, key?: string) {
const urlObj = new URL(`${window.location.origin}${_basePath}/asset/file/${assetId}`);
if (isThumb !== undefined && isThumb !== null)
urlObj.searchParams.append('isThumb', `${isThumb}`);
if (isWeb !== undefined && isWeb !== null) urlObj.searchParams.append('isWeb', `${isWeb}`);
if (key !== undefined && key !== null) urlObj.searchParams.append('key', key);
return urlObj.href;
}
export type ApiError = AxiosError<{ message: string }>;
export const oauth = {