mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(web): use ImmichApi to create urls (#2435)
This commit is contained in:
parent
15fa8250cb
commit
4524aa0d06
13 changed files with 53 additions and 51 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue