mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
ignoring assignments that cannot be parsed
This commit is contained in:
@@ -11,12 +11,12 @@ export const GET = async (
|
||||
}
|
||||
) =>
|
||||
await withErrorHandling(async () => {
|
||||
const settings = await fileStorageService.assignments.getAssignment(
|
||||
const assignment = await fileStorageService.assignments.getAssignment(
|
||||
courseName,
|
||||
moduleName,
|
||||
assignmentName
|
||||
);
|
||||
return Response.json(settings);
|
||||
return Response.json(assignment);
|
||||
});
|
||||
|
||||
export const PUT = async (
|
||||
|
||||
@@ -6,10 +6,27 @@ export const GET = async (
|
||||
{
|
||||
params: { courseName, moduleName },
|
||||
}: { params: { courseName: string; moduleName: string } }
|
||||
) => await withErrorHandling(async () => {
|
||||
const settings = await fileStorageService.assignments.getAssignmentNames(
|
||||
courseName,
|
||||
moduleName
|
||||
);
|
||||
return Response.json(settings);
|
||||
})
|
||||
) =>
|
||||
await withErrorHandling(async () => {
|
||||
const names = await fileStorageService.assignments.getAssignmentNames(
|
||||
courseName,
|
||||
moduleName
|
||||
);
|
||||
const assignments = (
|
||||
await Promise.all(
|
||||
names.map(async (name) => {
|
||||
try {
|
||||
return await fileStorageService.assignments.getAssignment(
|
||||
courseName,
|
||||
moduleName,
|
||||
name
|
||||
);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
)
|
||||
).filter((a) => a !== null);
|
||||
|
||||
return Response.json(assignments);
|
||||
});
|
||||
|
||||
@@ -2,11 +2,12 @@ import { LocalCourse } from "@/models/local/localCourse";
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { withErrorHandling } from "@/services/withErrorHandling";
|
||||
|
||||
export const GET = async () =>
|
||||
await withErrorHandling(async () => {
|
||||
const courses = await fileStorageService.getCourseNames();
|
||||
return Response.json(courses);
|
||||
});
|
||||
// replace with get all settings
|
||||
// export const GET = async () =>
|
||||
// await withErrorHandling(async () => {
|
||||
// const courses = await fileStorageService.getCourseNames();
|
||||
// return Response.json(courses);
|
||||
// });
|
||||
|
||||
export const POST = async (request: Request) =>
|
||||
await withErrorHandling(async () => {
|
||||
|
||||
@@ -92,23 +92,15 @@ function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
||||
<Link className="ms-1" href={getLectureUrl(courseName, day)}>
|
||||
{dayAsDate.getDate()}
|
||||
</Link>
|
||||
<Modal buttonText="+" buttonClass="unstyled hover:font-bold px-1 mb-auto mt-0 pt-0">
|
||||
<Modal
|
||||
buttonText="+"
|
||||
buttonClass="unstyled hover:font-bold px-1 mb-auto mt-0 pt-0"
|
||||
>
|
||||
{({ closeModal }) => (
|
||||
<div>
|
||||
<NewItemForm
|
||||
creationDate={day}
|
||||
onCreate={() => {
|
||||
closeModal();
|
||||
}}
|
||||
/>
|
||||
<NewItemForm creationDate={day} onCreate={closeModal} />
|
||||
<br />
|
||||
<button
|
||||
onClick={() => {
|
||||
closeModal();
|
||||
}}
|
||||
>
|
||||
close
|
||||
</button>
|
||||
<button onClick={closeModal}>close</button>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import {
|
||||
useAssignmentNamesQuery,
|
||||
useAssignmentsQueries,
|
||||
} from "@/hooks/localCourse/assignmentHooks";
|
||||
import {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
"use client";
|
||||
import {
|
||||
QueryClientProvider,
|
||||
} from "@tanstack/react-query";
|
||||
import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import { ReactNode } from "react";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
import { getQueryClient } from "./providersQueryClientUtils";
|
||||
|
||||
import { SuspenseAndErrorHandling } from "@/components/SuspenseAndErrorHandling";
|
||||
|
||||
export default function Providers({ children }: { children: ReactNode }) {
|
||||
// NOTE: Avoid useState when initializing the query client if you don't
|
||||
@@ -16,9 +14,11 @@ export default function Providers({ children }: { children: ReactNode }) {
|
||||
const queryClient = getQueryClient();
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{/* <ReactQueryDevtools initialIsOpen={false} /> */}
|
||||
{children}
|
||||
</QueryClientProvider>
|
||||
<SuspenseAndErrorHandling>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{/* <ReactQueryDevtools initialIsOpen={false} /> */}
|
||||
{children}
|
||||
</QueryClientProvider>
|
||||
</SuspenseAndErrorHandling>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isServer, QueryClient } from "@tanstack/react-query";
|
||||
import { isServer, QueryCache, QueryClient } from "@tanstack/react-query";
|
||||
|
||||
export function makeQueryClient() {
|
||||
return new QueryClient({
|
||||
@@ -13,6 +13,9 @@ export function makeQueryClient() {
|
||||
refetchOnMount: false,
|
||||
},
|
||||
},
|
||||
queryCache: new QueryCache({
|
||||
onError: (e) => console.log("error in query client", e),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user