mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
refactor(web): use new open api client (#7097)
* refactor(web): use new open api client * refactor: remove activity api * refactor: trash, oauth, and partner apis * refactor: job api * refactor: face, library, system config * refactor: user api * refactor: album api
This commit is contained in:
parent
9b4a770b9d
commit
8fd94211c0
66 changed files with 593 additions and 850 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import type { AxiosError, AxiosPromise } from 'axios';
|
||||
import { finishOAuth, linkOAuthAccount, startOAuth, unlinkOAuthAccount } from '@immich/sdk';
|
||||
import type { UserResponseDto } from '@immich/sdk/axios';
|
||||
import type { AxiosError } from 'axios';
|
||||
import {
|
||||
notificationController,
|
||||
NotificationType,
|
||||
notificationController,
|
||||
} from '../lib/components/shared-components/notification/notification';
|
||||
import { handleError } from '../lib/utils/handle-error';
|
||||
import { api } from './api';
|
||||
import type { UserResponseDto } from '@immich/sdk/axios';
|
||||
|
||||
export type ApiError = AxiosError<{ message: string }>;
|
||||
|
||||
|
|
@ -43,8 +43,8 @@ export const oauth = {
|
|||
authorize: async (location: Location) => {
|
||||
try {
|
||||
const redirectUri = location.href.split('?')[0];
|
||||
const { data } = await api.oauthApi.startOAuth({ oAuthConfigDto: { redirectUri } });
|
||||
window.location.href = data.url;
|
||||
const { url } = await startOAuth({ oAuthConfigDto: { redirectUri } });
|
||||
window.location.href = url;
|
||||
return true;
|
||||
} catch (error) {
|
||||
handleError(error, 'Unable to login with OAuth');
|
||||
|
|
@ -52,12 +52,12 @@ export const oauth = {
|
|||
}
|
||||
},
|
||||
login: (location: Location) => {
|
||||
return api.oauthApi.finishOAuth({ oAuthCallbackDto: { url: location.href } });
|
||||
return finishOAuth({ oAuthCallbackDto: { url: location.href } });
|
||||
},
|
||||
link: (location: Location): AxiosPromise<UserResponseDto> => {
|
||||
return api.oauthApi.linkOAuthAccount({ oAuthCallbackDto: { url: location.href } });
|
||||
link: (location: Location): Promise<UserResponseDto> => {
|
||||
return linkOAuthAccount({ oAuthCallbackDto: { url: location.href } });
|
||||
},
|
||||
unlink: () => {
|
||||
return api.oauthApi.unlinkOAuthAccount();
|
||||
return unlinkOAuthAccount();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue