Skip to content

Commit

Permalink
chore: path
Browse files Browse the repository at this point in the history
  • Loading branch information
lencx committed Nov 13, 2023
1 parent 27f398b commit 3c638c6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/views/GPTDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { useParams } from 'react-router-dom';
import { useLayoutEffect, useMemo } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import dayjs from 'dayjs';

import { gptLink } from '@/utils';
Expand All @@ -11,6 +11,11 @@ import data from '@@/gpthub.json';

export default function GPTs() {
const params = useParams();
const navigate = useNavigate();

useLayoutEffect(() => {
navigate(`/gpts/${params?.id}`)
}, [params?.id, navigate])

const gptInfo = useMemo(() => {
return data?.gpts?.find((item) => item.id === params?.id);
Expand Down

0 comments on commit 3c638c6

Please sign in to comment.