Skip to content

Commit 0c5a51c

Browse files
committed
[TOOL-3243] Dashboard: Add redirect for support old engine import link (#6254)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR enhances the `Page` function in `page.tsx` to handle `searchParams`, allowing for an import URL to trigger a redirect when present. ### Detailed summary - Added `searchParams` to the `Page` function's props. - Used `Promise.all` to await both `params` and `searchParams`. - Implemented a redirect to an import URL if `searchParams.importUrl` is provided. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 90428b4 commit 0c5a51c

File tree

1 file changed

+15
-1
lines changed
  • apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(general)

1 file changed

+15
-1
lines changed

apps/dashboard/src/app/team/[team_slug]/(team)/~/engine/(general)/page.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { redirect } from "next/navigation";
12
import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
23
import { loginRedirect } from "../../../../../../login/loginRedirect";
34
import { getEngineInstances } from "../_utils/getEngineInstances";
@@ -10,8 +11,21 @@ export default async function Page(props: {
1011
params: Promise<{
1112
team_slug: string;
1213
}>;
14+
searchParams: Promise<{
15+
importUrl?: string;
16+
}>;
1317
}) {
14-
const params = await props.params;
18+
const [params, searchParams] = await Promise.all([
19+
props.params,
20+
props.searchParams,
21+
]);
22+
23+
if (searchParams.importUrl) {
24+
redirect(
25+
`/team/${params.team_slug}/~/engine/import?importUrl=${searchParams.importUrl}`,
26+
);
27+
}
28+
1529
const authToken = await getAuthToken();
1630

1731
if (!authToken) {

0 commit comments

Comments
 (0)