mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-26 15:44:37 +01:00
feat: remove patreon
This commit is contained in:
1 parent
da8025a0ad
commit
0df58d2d2c
13 files changed
+21
-326
No files matched your search
@@ -1,24 +1,14 @@
|
||||
import { useEffect } from 'react';
|
||||
import { App } from '../../../stores/app';
|
||||
|
||||
export const AUTH_PROVIDERS = ['wargaming', 'patreon'] as const;
|
||||
export const AUTH_PROVIDERS = ['wargaming'] as const;
|
||||
|
||||
type AuthProvider = (typeof AUTH_PROVIDERS)[number];
|
||||
|
||||
export const AUTH_PROVIDER_NAMES: Record<AuthProvider, string> = {
|
||||
patreon: 'Patreon',
|
||||
wargaming: 'Wargaming',
|
||||
};
|
||||
|
||||
export interface PatreonAuthResponse {
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
token_type: 'Bearer';
|
||||
scope: string;
|
||||
refresh_token: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface AuthorizeProps {
|
||||
provider: AuthProvider;
|
||||
}
|
||||
@@ -59,25 +49,6 @@ function Content({ provider }: AuthorizeProps) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'patreon': {
|
||||
if (!searchParams.get('code')) break;
|
||||
|
||||
const response = await fetch('/api/patreon/auth', {
|
||||
headers: { code: searchParams.get('code')! },
|
||||
});
|
||||
const data = (await response.json()) as PatreonAuthResponse;
|
||||
|
||||
mutateApp((draft) => {
|
||||
draft.logins.patreon = {
|
||||
token: data.access_token,
|
||||
refreshToken: data.refresh_token,
|
||||
expires: Date.now() + data.expires_in * 1000,
|
||||
};
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(`Unknown provider: ${provider}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user