moving data to be held by react query

This commit is contained in:
2024-08-30 09:12:25 -06:00
parent 9d6a3d1199
commit 5d9ece63fa
15 changed files with 185 additions and 175 deletions

View File

@@ -9,15 +9,6 @@ export async function PUT(
console.log(updatedCourse);
console.log(courseName);
await fileStorageService.saveCourseAsync(updatedCourse, previousCourse);
// await fileStorageService.saveCourseAsync(updatedCourse, previousCourse);
return Response.json({});
}
export async function GET(
request: Request,
{ params: { courseName } }: { params: { courseName: string } }
) {
const courses = await fileStorageService.loadSavedCourses();
const course = courses.find((c) => c.settings.name === courseName);
return Response.json(course);
}

View File

@@ -0,0 +1,9 @@
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
export async function GET(
_request: Request,
{ params: { courseName } }: { params: { courseName: string } }
) {
const settings = await fileStorageService.getCourseSettings(courseName)
return Response.json(settings);
}

View File

@@ -1,6 +1,7 @@
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
export async function GET() {
const courses = await fileStorageService.loadSavedCourses();
const courses = await fileStorageService.getCourseNames();
return Response.json(courses);
}