feat: enable workspace cloud

This commit is contained in:
DiamondThree
2023-01-10 16:50:25 +08:00
parent 223f08c439
commit fe3c7b446f
2 changed files with 14 additions and 2 deletions

View File

@@ -1,10 +1,21 @@
import { useAppState } from '@/providers/app-state-provider';
import { User } from '@affine/datacenter';
import { useState } from 'react';
import { useEffect, useState } from 'react';
export const useUserHelper = () => {
const { dataCenter } = useAppState();
const [user, setUser] = useState<User | undefined>(undefined);
useEffect(() => {
dataCenter
.getUserInfo()
.then(user => {
setUser(user);
})
.catch(e => {
setUser(undefined);
});
}, []);
const login = async () => {
await dataCenter.login();
const user = await dataCenter.getUserInfo();

View File

@@ -33,7 +33,8 @@ export const useWorkspaceHelper = () => {
};
const enableWorkspace = async (workspace: Workspace) => {
dataCenter.enableWorkspaceCloud(workspace);
const newWorkspace = await dataCenter.enableWorkspaceCloud(workspace);
console.log('newWorkspace: ', newWorkspace);
};
return {
createWorkspace,