feat(core): try cloud link (#6660)

This commit is contained in:
EYHN 2024-04-22 08:51:02 +00:00
parent 94de6f5853
commit d36b5e14aa
No known key found for this signature in database
GPG Key ID: 46C9E26A75AB276C
2 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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'),