feat(classes): optimize teacher dashboard ui and implement grade management
This commit is contained in:
@@ -9,10 +9,28 @@ import {
|
||||
createKnowledgePoint,
|
||||
deleteKnowledgePoint,
|
||||
updateTextbook,
|
||||
deleteTextbook
|
||||
deleteTextbook,
|
||||
reorderChapters
|
||||
} from "./data-access";
|
||||
import { CreateTextbookInput, UpdateTextbookInput } from "./types";
|
||||
|
||||
// ... existing code ...
|
||||
|
||||
export async function reorderChaptersAction(
|
||||
chapterId: string,
|
||||
newIndex: number,
|
||||
parentId: string | null,
|
||||
textbookId: string
|
||||
): Promise<ActionState> {
|
||||
try {
|
||||
await reorderChapters(chapterId, newIndex, parentId);
|
||||
revalidatePath(`/teacher/textbooks/${textbookId}`);
|
||||
return { success: true, message: "Chapters reordered successfully" };
|
||||
} catch {
|
||||
return { success: false, message: "Failed to reorder chapters" };
|
||||
}
|
||||
}
|
||||
|
||||
export type ActionState = {
|
||||
success: boolean;
|
||||
message?: string;
|
||||
|
||||
Reference in New Issue
Block a user