mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
parent
7c2f7d6c51
commit
f55b3add80
242 changed files with 12794 additions and 13426 deletions
|
|
@ -5,31 +5,31 @@ import type { UserResponseDto } from './open-api';
|
|||
export type ApiError = AxiosError<{ message: string }>;
|
||||
|
||||
export const oauth = {
|
||||
isCallback: (location: Location) => {
|
||||
const search = location.search;
|
||||
return search.includes('code=') || search.includes('error=');
|
||||
},
|
||||
isAutoLaunchDisabled: (location: Location) => {
|
||||
const values = ['autoLaunch=0', 'password=1', 'password=true'];
|
||||
for (const value of values) {
|
||||
if (location.search.includes(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getConfig: (location: Location) => {
|
||||
const redirectUri = location.href.split('?')[0];
|
||||
console.log(`OAuth Redirect URI: ${redirectUri}`);
|
||||
return api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri } });
|
||||
},
|
||||
login: (location: Location) => {
|
||||
return api.oauthApi.callback({ oAuthCallbackDto: { url: location.href } });
|
||||
},
|
||||
link: (location: Location): AxiosPromise<UserResponseDto> => {
|
||||
return api.oauthApi.link({ oAuthCallbackDto: { url: location.href } });
|
||||
},
|
||||
unlink: () => {
|
||||
return api.oauthApi.unlink();
|
||||
}
|
||||
isCallback: (location: Location) => {
|
||||
const search = location.search;
|
||||
return search.includes('code=') || search.includes('error=');
|
||||
},
|
||||
isAutoLaunchDisabled: (location: Location) => {
|
||||
const values = ['autoLaunch=0', 'password=1', 'password=true'];
|
||||
for (const value of values) {
|
||||
if (location.search.includes(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getConfig: (location: Location) => {
|
||||
const redirectUri = location.href.split('?')[0];
|
||||
console.log(`OAuth Redirect URI: ${redirectUri}`);
|
||||
return api.oauthApi.generateConfig({ oAuthConfigDto: { redirectUri } });
|
||||
},
|
||||
login: (location: Location) => {
|
||||
return api.oauthApi.callback({ oAuthCallbackDto: { url: location.href } });
|
||||
},
|
||||
link: (location: Location): AxiosPromise<UserResponseDto> => {
|
||||
return api.oauthApi.link({ oAuthCallbackDto: { url: location.href } });
|
||||
},
|
||||
unlink: () => {
|
||||
return api.oauthApi.unlink();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue