Skip to content

Commit

Permalink
fix(page.tsx): replace throwing error with redirect to /projects when…
Browse files Browse the repository at this point in the history
… project is not found
  • Loading branch information
masterkain committed May 28, 2023
1 parent dbbcc4e commit dd8dc1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/projects/[project_id]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { jsclientTemplate, rubyTemplate } from '@/lib/configTemplates';
import { getProjectById } from '@/lib/queries/projects';
import type { Route } from 'next';
import Link from 'next/link';
import { redirect } from 'next/navigation';
import { SlSettings, SlWrench } from 'react-icons/sl';

export default async function Project({
Expand All @@ -22,7 +23,7 @@ export default async function Project({

const project = await getProjectById(params.project_id);
if (!project) {
throw new Error('Project not found');
redirect('/projects');
}
const replacements = {
REPLACE_PROJECT_KEY: project.api_key,
Expand Down

0 comments on commit dd8dc1d

Please sign in to comment.