mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-26 03:59:53 +01:00
feat: more login progress
This commit is contained in:
1 parent
1e64cb9e7d
commit
513105a624
18 files changed
+290
-295
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useEffect } from 'react';
|
||||
import { $patreonLogin } from '../../../stores/patreonLogin';
|
||||
import { App } from '../../../stores/app';
|
||||
import { $wargamingLogin } from '../../../stores/wargamingLogin';
|
||||
|
||||
export const AUTH_PROVIDERS = ['wargaming', 'patreon'] as const;
|
||||
@@ -25,6 +25,8 @@ interface AuthorizeProps {
|
||||
}
|
||||
|
||||
export function Authorize({ provider }: AuthorizeProps) {
|
||||
const mutateApp = App.useMutation();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
@@ -56,10 +58,12 @@ export function Authorize({ provider }: AuthorizeProps) {
|
||||
);
|
||||
const data = (await response.json()) as PatreonAuthResponse;
|
||||
|
||||
$patreonLogin.set({
|
||||
token: data.access_token,
|
||||
refreshToken: data.refresh_token,
|
||||
expires: `${Date.now() + data.expires_in * 1000}`,
|
||||
mutateApp((draft) => {
|
||||
draft.logins.patreon = {
|
||||
token: data.access_token,
|
||||
refreshToken: data.refresh_token,
|
||||
expires: Date.now() + data.expires_in * 1000,
|
||||
};
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { PageWrapper } from '../../../components/PageWrapper';
|
||||
import { TankSearch } from '../../../components/TankSearch';
|
||||
import { App } from '../../../stores/app';
|
||||
|
||||
export function Page() {
|
||||
return (
|
||||
<PageWrapper color="purple" size={1028}>
|
||||
<TankSearch />
|
||||
<App.Provider>
|
||||
<TankSearch />
|
||||
</App.Provider>
|
||||
</PageWrapper>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user