From d36b5e14aa7e8b3e9770919e88c9b12420497a99 Mon Sep 17 00:00:00 2001 From: EYHN Date: Mon, 22 Apr 2024 08:51:02 +0000 Subject: [PATCH] feat(core): try cloud link (#6660) --- packages/frontend/core/src/pages/index.tsx | 1 - packages/frontend/core/src/router.tsx | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/pages/index.tsx b/packages/frontend/core/src/pages/index.tsx index e8ee9ff064..5047947277 100644 --- a/packages/frontend/core/src/pages/index.tsx +++ b/packages/frontend/core/src/pages/index.tsx @@ -77,7 +77,6 @@ export const Component = () => { // check is user logged in && has cloud workspace if (searchParams.get('initCloud') === 'true') { if (loggedIn) { - searchParams.delete('initCloud'); if (list.every(w => w.flavour !== WorkspaceFlavour.AFFINE_CLOUD)) { createCloudWorkspace(); return; diff --git a/packages/frontend/core/src/router.tsx b/packages/frontend/core/src/router.tsx index fe7acb81d6..081694c868 100644 --- a/packages/frontend/core/src/router.tsx +++ b/packages/frontend/core/src/router.tsx @@ -4,6 +4,7 @@ import type { NavigateFunction, RouteObject } from 'react-router-dom'; import { createBrowserRouter as reactRouterCreateBrowserRouter, Outlet, + redirect, useLocation, // eslint-disable-next-line @typescript-eslint/no-restricted-imports useNavigate, @@ -104,6 +105,14 @@ export const topLevelRoutes = [ path: '/subscribe', lazy: () => import('./pages/subscribe'), }, + { + path: '/try-cloud', + loader: () => { + return redirect( + `/signIn?redirect_uri=${encodeURIComponent('/?initCloud=true')}` + ); + }, + }, { path: '*', lazy: () => import('./pages/404'),