-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from appKom/178
Refactor fetching logic
- Loading branch information
Showing
11 changed files
with
168 additions
and
161 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Image from "next/image"; | ||
import { useTheme } from "../lib/hooks/useTheme"; | ||
|
||
const ErrorPage = () => { | ||
const theme = useTheme(); | ||
|
||
const onlineLogoSrc = | ||
theme === "dark" ? "/Online_hvit.svg" : "/Online_bla.svg"; | ||
|
||
return ( | ||
<div className="flex flex-col items-center justify-center h-full gap-10 bg-white dark:bg-gray-900"> | ||
<Image | ||
src={onlineLogoSrc} | ||
width={300} | ||
height={100} | ||
alt="Online logo" | ||
/> | ||
<div className="text-xl text-black dark:text-white">Det har skjedd en feil :(</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ErrorPage; |
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,9 @@ | ||
import { QueryFunctionContext } from '@tanstack/react-query'; | ||
|
||
export const fetchApplicantByPeriodAndId = async (context: QueryFunctionContext) => { | ||
const periodId = context.queryKey[1]; | ||
const applicantId = context.queryKey[2]; | ||
return fetch(`/api/applicants/${periodId}/${applicantId}`).then(res => | ||
res.json() | ||
); | ||
} |
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,8 @@ | ||
import { QueryFunctionContext } from '@tanstack/react-query'; | ||
|
||
export const fetchPeriodById = async (context: QueryFunctionContext) => { | ||
const id = context.queryKey[1]; | ||
return fetch(`/api/periods/${id}`).then(res => | ||
res.json() | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.