Skip to content

Commit

Permalink
feat: Support customizing the redirection target of the index page (#413
Browse files Browse the repository at this point in the history
)
  • Loading branch information
CH3CHO authored Jan 20, 2025
1 parent 2753367 commit 5b1309d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/src/interfaces/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const SYSTEM_INITIALIZED = 'system.initialized';
export const LOGIN_PROMPT = 'login.prompt';
export const INDEX_REDIRECT_TARGET = 'index.redirect-target';

export const MODE = 'mode';

Expand Down
8 changes: 7 additions & 1 deletion frontend/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { definePageConfig, useNavigate } from 'ice';
import { useEffect } from "react";
import store from '@/store';
import { INDEX_REDIRECT_TARGET } from '@/interfaces/config';

export default function SourcePage() {
const [configModel] = store.useModel('config');
const navigate = useNavigate();

useEffect(() => {
navigate('/route', { replace: true });
const properties = configModel ? configModel.properties : {};
const redirectTarget = properties[INDEX_REDIRECT_TARGET] || '/route';
navigate(redirectTarget, { replace: true });
}, []);
}

Expand Down

0 comments on commit 5b1309d

Please sign in to comment.