add
This commit is contained in:
parent
0597b4f5b3
commit
fb026e1fde
|
@ -1,6 +1,7 @@
|
|||
import { api } from "@nice/client";
|
||||
import { courseDetailSelect, CourseDto } from "@nice/common";
|
||||
import React, { createContext, ReactNode, useState } from "react";
|
||||
import React, { createContext, ReactNode, useEffect, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
interface CourseDetailContextType {
|
||||
editId?: string; // 添加 editId
|
||||
|
@ -21,7 +22,7 @@ export function CourseDetailProvider({
|
|||
children,
|
||||
editId,
|
||||
}: CourseFormProviderProps) {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { data: course, isLoading }: { data: CourseDto; isLoading: boolean } =
|
||||
(api.post as any).findFirst.useQuery(
|
||||
{
|
||||
|
@ -36,6 +37,10 @@ export function CourseDetailProvider({
|
|||
const [selectedLectureId, setSelectedLectureId] = useState<
|
||||
string | undefined
|
||||
>(undefined);
|
||||
useEffect(() => {
|
||||
navigate(``)
|
||||
|
||||
}, [selectedLectureId, editId]);
|
||||
const [isHeaderVisible, setIsHeaderVisible] = useState(true); // 新增
|
||||
return (
|
||||
<CourseDetailContext.Provider
|
||||
|
|
Loading…
Reference in New Issue