-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch section tasks from API, update next.js
- Loading branch information
Showing
7 changed files
with
586 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
"use client"; | ||
import { TaskList } from "@/components/tasks/task-list"; | ||
export default function Page() { | ||
return <TaskList />; | ||
|
||
export default async function Page({ | ||
params, | ||
}: { | ||
params: Promise<{ id: string }> | ||
}) { | ||
const { id } = await params; | ||
return <TaskList sectionId={id} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import useSWR from "swr"; | ||
import { fetcher } from "@/hooks/fetcher"; | ||
|
||
export const useSection = (sectionId) => { | ||
const { data, error, isLoading } = useSWR(`/api/section/${sectionId}`, fetcher); | ||
return { | ||
section: data, | ||
isLoading, | ||
isError: error, | ||
}; | ||
}; |
Oops, something went wrong.