mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
feat: cleanup fetcher for prepare refactor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { signInWithGoogle, login, setToken } from '@pathfinder/data-services';
|
||||
import { signInWithGoogle } from '@pathfinder/data-services';
|
||||
import { styled } from '@/styles';
|
||||
import { Button } from '@/ui/button';
|
||||
import { useModal } from '@/providers/global-modal-provider';
|
||||
@@ -10,13 +10,7 @@ export const GoogleLoginButton = () => {
|
||||
<StyledGoogleButton
|
||||
onClick={() => {
|
||||
signInWithGoogle()
|
||||
.then(async user => {
|
||||
const idToken = await user.user.getIdToken();
|
||||
const token = await login({ token: idToken, type: 'Google' });
|
||||
setToken({
|
||||
accessToken: token.token,
|
||||
refreshToken: token.refresh,
|
||||
});
|
||||
.then(async => {
|
||||
triggerLoginModal();
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
@@ -94,7 +94,7 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
||||
const editor = createEditorHandler?.(currentPage) || null;
|
||||
|
||||
if (editor) {
|
||||
const pageMeta = currentWorkspace?.meta.pageMetas.find(
|
||||
const pageMeta = currentWorkspace.meta.pageMetas.find(
|
||||
p => p.id === currentPage.pageId
|
||||
);
|
||||
if (pageMeta?.mode) {
|
||||
@@ -133,13 +133,13 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
||||
const callback = async (user: AccessTokenMessage | null) => {
|
||||
const workspacesMeta = user ? await getWorkspaces() : [];
|
||||
const workspacesList = await Promise.all(
|
||||
workspacesMeta?.map(async ({ id }) => {
|
||||
workspacesMeta.map(async ({ id }) => {
|
||||
const workspace = (await loadWorkspaceHandler?.(id)) || null;
|
||||
return { id, workspace };
|
||||
})
|
||||
);
|
||||
|
||||
let workspaces: Record<string, Workspace | null> = {};
|
||||
const workspaces: Record<string, Workspace | null> = {};
|
||||
|
||||
workspacesList.forEach(({ id, workspace }) => {
|
||||
workspaces[id] = workspace;
|
||||
|
||||
Reference in New Issue
Block a user