mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-29 05:11:51 +03:00
feat: enable workspace cloud
This commit is contained in:
parent
60b379fcad
commit
c723c18086
@ -12,12 +12,14 @@ import { useAppState } from '@/providers/app-state-provider';
|
||||
import { useConfirm } from '@/providers/ConfirmProvider';
|
||||
import { toast } from '@/ui/toast';
|
||||
import { useUserHelper } from '@/hooks/use-user-helper';
|
||||
import { useRouter } from 'next/router';
|
||||
export const SyncPage = ({ workspace }: { workspace: WorkspaceInfo }) => {
|
||||
// console.log('workspace: ', workspace);
|
||||
const { enableWorkspace } = useWorkspaceHelper();
|
||||
const { currentWorkspace } = useAppState();
|
||||
const { confirm } = useConfirm();
|
||||
const { user, login } = useUserHelper();
|
||||
const router = useRouter();
|
||||
return (
|
||||
<div>
|
||||
<StyledPublishContent>
|
||||
@ -42,7 +44,8 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceInfo }) => {
|
||||
// if (user) {
|
||||
// await login();
|
||||
// }
|
||||
await enableWorkspace(currentWorkspace);
|
||||
const id = await enableWorkspace(currentWorkspace);
|
||||
router.push(`/workspace/${id}`);
|
||||
toast('Enabled success');
|
||||
}
|
||||
});
|
||||
|
@ -8,6 +8,7 @@ const defaultOutLineWorkspaceId = 'affine';
|
||||
export const useEnsureWorkspace = () => {
|
||||
const [workspaceLoaded, setWorkspaceLoaded] = useState(false);
|
||||
const { workspaceList, loadWorkspace, user } = useAppState();
|
||||
console.log('workspaceList: ', workspaceList);
|
||||
const router = useRouter();
|
||||
|
||||
// const defaultOutLineWorkspaceId = '99ce7eb7';
|
||||
|
@ -33,8 +33,9 @@ export const useWorkspaceHelper = () => {
|
||||
};
|
||||
|
||||
const enableWorkspace = async (workspace: Workspace) => {
|
||||
const newWorkspace = await dataCenter.enableWorkspaceCloud(workspace);
|
||||
console.log('newWorkspace: ', newWorkspace);
|
||||
const newWorkspaceId = await dataCenter.enableWorkspaceCloud(workspace);
|
||||
// console.log('newWorkspace: ', newWorkspace);
|
||||
return newWorkspaceId;
|
||||
};
|
||||
return {
|
||||
createWorkspace,
|
||||
|
@ -1,4 +1,9 @@
|
||||
import NotfoundPage from '@/components/404';
|
||||
import { useAppState } from '@/providers/app-state-provider';
|
||||
|
||||
export default function Custom404() {
|
||||
const { workspaceList } = useAppState();
|
||||
console.log('workspaceList: ', workspaceList);
|
||||
|
||||
return <NotfoundPage></NotfoundPage>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user