mirror of https://github.com/buster-so/buster.git
Merge pull request #1113 from buster-so/dallin-bus-1915-make-getting-started-page
Add InfoGettingStarted route and update route interfaces
This commit is contained in:
commit
31c17c94d0
|
@ -25,12 +25,6 @@ export const createAxiosInstance = (baseURL = BASE_URL_V2) => {
|
|||
async (error: AxiosError) => {
|
||||
const errorCode = error.response?.status;
|
||||
|
||||
//402 is the payment required error code
|
||||
if (errorCode === 402) {
|
||||
window.location.href = AuthRoute.to;
|
||||
return Promise.reject(rustErrorHandler(error));
|
||||
}
|
||||
|
||||
// Handle 401 Unauthorized - token might be expired
|
||||
if (errorCode === 401 && !isServer) {
|
||||
console.info(
|
||||
|
|
|
@ -309,7 +309,7 @@ const AlreadyHaveAccount: React.FC<{
|
|||
const handleToggleClick = () => {
|
||||
if (!signUpFlow) {
|
||||
// User clicked "Sign up" - redirect to get-started page
|
||||
window.location.href = 'https://www.buster.so/get-started';
|
||||
// window.location.href = 'https://www.buster.so/get-started';
|
||||
} else {
|
||||
// User clicked "Sign in" - use existing toggle logic
|
||||
setErrorMessages([]);
|
||||
|
@ -318,9 +318,9 @@ const AlreadyHaveAccount: React.FC<{
|
|||
}
|
||||
|
||||
// TODO: Original toggle logic preserved for future re-enablement
|
||||
// setErrorMessages([]);
|
||||
// setPassword2('');
|
||||
// setSignUpFlow(!signUpFlow);
|
||||
setErrorMessages([]);
|
||||
setPassword2('');
|
||||
setSignUpFlow(!signUpFlow);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
@ -18,6 +18,7 @@ import { Route as AuthRouteImport } from './routes/auth'
|
|||
import { Route as AppRouteImport } from './routes/app'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as AppIndexRouteImport } from './routes/app/index'
|
||||
import { Route as InfoGettingStartedRouteImport } from './routes/info/getting-started'
|
||||
import { Route as AuthResetPasswordRouteImport } from './routes/auth.reset-password'
|
||||
import { Route as AuthLogoutRouteImport } from './routes/auth.logout'
|
||||
import { Route as AuthLoginRouteImport } from './routes/auth.login'
|
||||
|
@ -191,6 +192,11 @@ const AppIndexRoute = AppIndexRouteImport.update({
|
|||
path: '/',
|
||||
getParentRoute: () => AppRoute,
|
||||
} as any)
|
||||
const InfoGettingStartedRoute = InfoGettingStartedRouteImport.update({
|
||||
id: '/info/getting-started',
|
||||
path: '/info/getting-started',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const AuthResetPasswordRoute = AuthResetPasswordRouteImport.update({
|
||||
id: '/reset-password',
|
||||
path: '/reset-password',
|
||||
|
@ -936,6 +942,7 @@ export interface FileRoutesByFullPath {
|
|||
'/auth/login': typeof AuthLoginRoute
|
||||
'/auth/logout': typeof AuthLogoutRoute
|
||||
'/auth/reset-password': typeof AuthResetPasswordRoute
|
||||
'/info/getting-started': typeof InfoGettingStartedRoute
|
||||
'/app/': typeof AppIndexRoute
|
||||
'/app/healthcheck': typeof AppAppHealthcheckRoute
|
||||
'/app/home': typeof AppAppHomeRoute
|
||||
|
@ -1044,6 +1051,7 @@ export interface FileRoutesByTo {
|
|||
'/auth/login': typeof AuthLoginRoute
|
||||
'/auth/logout': typeof AuthLogoutRoute
|
||||
'/auth/reset-password': typeof AuthResetPasswordRoute
|
||||
'/info/getting-started': typeof InfoGettingStartedRoute
|
||||
'/app/healthcheck': typeof AppAppHealthcheckRoute
|
||||
'/app/home': typeof AppAppHomeRoute
|
||||
'/embed/dashboard/$dashboardId': typeof EmbedDashboardDashboardIdRoute
|
||||
|
@ -1137,6 +1145,7 @@ export interface FileRoutesById {
|
|||
'/auth/login': typeof AuthLoginRoute
|
||||
'/auth/logout': typeof AuthLogoutRoute
|
||||
'/auth/reset-password': typeof AuthResetPasswordRoute
|
||||
'/info/getting-started': typeof InfoGettingStartedRoute
|
||||
'/app/': typeof AppIndexRoute
|
||||
'/app/_app/_asset': typeof AppAppAssetRouteWithChildren
|
||||
'/app/_app/healthcheck': typeof AppAppHealthcheckRoute
|
||||
|
@ -1261,6 +1270,7 @@ export interface FileRouteTypes {
|
|||
| '/auth/login'
|
||||
| '/auth/logout'
|
||||
| '/auth/reset-password'
|
||||
| '/info/getting-started'
|
||||
| '/app/'
|
||||
| '/app/healthcheck'
|
||||
| '/app/home'
|
||||
|
@ -1369,6 +1379,7 @@ export interface FileRouteTypes {
|
|||
| '/auth/login'
|
||||
| '/auth/logout'
|
||||
| '/auth/reset-password'
|
||||
| '/info/getting-started'
|
||||
| '/app/healthcheck'
|
||||
| '/app/home'
|
||||
| '/embed/dashboard/$dashboardId'
|
||||
|
@ -1461,6 +1472,7 @@ export interface FileRouteTypes {
|
|||
| '/auth/login'
|
||||
| '/auth/logout'
|
||||
| '/auth/reset-password'
|
||||
| '/info/getting-started'
|
||||
| '/app/'
|
||||
| '/app/_app/_asset'
|
||||
| '/app/_app/healthcheck'
|
||||
|
@ -1581,6 +1593,7 @@ export interface RootRouteChildren {
|
|||
AuthRoute: typeof AuthRouteWithChildren
|
||||
EmbedRoute: typeof EmbedRouteWithChildren
|
||||
HealthcheckRoute: typeof HealthcheckRoute
|
||||
InfoGettingStartedRoute: typeof InfoGettingStartedRoute
|
||||
}
|
||||
export interface FileServerRoutesByFullPath {
|
||||
'/auth/callback': typeof AuthCallbackServerRoute
|
||||
|
@ -1648,6 +1661,13 @@ declare module '@tanstack/react-router' {
|
|||
preLoaderRoute: typeof AppIndexRouteImport
|
||||
parentRoute: typeof AppRoute
|
||||
}
|
||||
'/info/getting-started': {
|
||||
id: '/info/getting-started'
|
||||
path: '/info/getting-started'
|
||||
fullPath: '/info/getting-started'
|
||||
preLoaderRoute: typeof InfoGettingStartedRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/auth/reset-password': {
|
||||
id: '/auth/reset-password'
|
||||
path: '/reset-password'
|
||||
|
@ -3240,6 +3260,7 @@ const rootRouteChildren: RootRouteChildren = {
|
|||
AuthRoute: AuthRouteWithChildren,
|
||||
EmbedRoute: EmbedRouteWithChildren,
|
||||
HealthcheckRoute: HealthcheckRoute,
|
||||
InfoGettingStartedRoute: InfoGettingStartedRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
|
|
|
@ -25,12 +25,18 @@ export const Route = createFileRoute('/app')({
|
|||
loader: async ({ context }) => {
|
||||
const { queryClient, supabaseSession } = context;
|
||||
try {
|
||||
await Promise.all([prefetchGetMyUserInfo(queryClient)]);
|
||||
|
||||
const [user] = await Promise.all([prefetchGetMyUserInfo(queryClient)]);
|
||||
if (!user || !user.organizations || user.organizations.length === 0) {
|
||||
throw redirect({ href: 'https://buster.so/sign-up', replace: true, statusCode: 307 });
|
||||
}
|
||||
return {
|
||||
supabaseSession,
|
||||
};
|
||||
} catch (error) {
|
||||
// Re-throw redirect Responses so the router can handle them (e.g., getting-started)
|
||||
if (error instanceof Response) {
|
||||
throw error;
|
||||
}
|
||||
console.error('Error in app route loader:', error);
|
||||
throw redirect({ to: '/auth/login', replace: true, statusCode: 307 });
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const Route = createFileRoute('/info/getting-started')({
|
||||
component: GettingStartedPage,
|
||||
});
|
||||
|
||||
export default function GettingStartedPage() {
|
||||
useEffect(() => {
|
||||
window.location.replace('https://buster.so/sign-up');
|
||||
}, []);
|
||||
return null;
|
||||
}
|
Loading…
Reference in New Issue