-
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.
Merge branch 'main' into DDFBRA-145-automatisk-tilgaengeligheds-tests
- Loading branch information
Showing
20 changed files
with
247 additions
and
220 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
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,31 @@ | ||
name: Prettier check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
# Make sure the actual branch is checked out when running on pull requests. | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 # 👈 Required to retrieve git history | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Check Prettier formatting | ||
run: yarn run format:check |
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,3 @@ | ||
.next | ||
generated | ||
node_modules |
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { z } from "zod"; | ||
import { z } from "zod" | ||
|
||
const schemas = { | ||
tokenSet: z.object({ | ||
access_token: z.string(), | ||
refresh_token: z.string(), | ||
id_token: z.string(), | ||
expires_in: z.number(), | ||
refresh_expires_in: z.number() | ||
refresh_expires_in: z.number(), | ||
}), | ||
introspect: z.object({ | ||
uniid: z.string(), | ||
institutionIds: z.string() | ||
institutionIds: z.string(), | ||
}), | ||
userInfo: z.object({ | ||
sub: z.string() | ||
}) | ||
}; | ||
sub: z.string(), | ||
}), | ||
} | ||
|
||
export default schemas; | ||
export default schemas |
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,27 +1,24 @@ | ||
import { generators } from "openid-client"; | ||
import { generators } from "openid-client" | ||
|
||
import { | ||
getUniloginClient, | ||
uniloginClientConfig | ||
} from "@/lib/session/oauth/uniloginClient"; | ||
import { getSession } from "@/lib/session/session"; | ||
import { getUniloginClient, uniloginClientConfig } from "@/lib/session/oauth/uniloginClient" | ||
import { getSession } from "@/lib/session/session" | ||
|
||
export async function GET() { | ||
const session = await getSession(); | ||
const session = await getSession() | ||
|
||
session.code_verifier = generators.codeVerifier(); | ||
session.code_verifier = generators.codeVerifier() | ||
|
||
const code_challenge = generators.codeChallenge(session.code_verifier); | ||
const code_challenge = generators.codeChallenge(session.code_verifier) | ||
|
||
const client = await getUniloginClient(); | ||
const client = await getUniloginClient() | ||
const url = client.authorizationUrl({ | ||
scope: uniloginClientConfig.scope, | ||
audience: uniloginClientConfig.audience, | ||
redirect_uri: uniloginClientConfig.redirect_uri, | ||
code_challenge, | ||
code_challenge_method: "S256" | ||
}); | ||
code_challenge_method: "S256", | ||
}) | ||
|
||
await session.save(); | ||
return Response.redirect(url); | ||
await session.save() | ||
return Response.redirect(url) | ||
} |
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,16 +1,16 @@ | ||
import { defaultSession, getSession } from "@/lib/session/session"; | ||
import { defaultSession, getSession } from "@/lib/session/session" | ||
|
||
export async function GET() { | ||
try { | ||
const session = await getSession(); | ||
const session = await getSession() | ||
if (!session) { | ||
return Response.json({ defaultSession }); | ||
return Response.json({ defaultSession }) | ||
} | ||
return Response.json({ | ||
isLoggedIn: session.isLoggedIn, | ||
userInfo: session.userInfo | ||
}); | ||
userInfo: session.userInfo, | ||
}) | ||
} catch (e) { | ||
return Response.json({ error: e }, { status: 500 }); | ||
return Response.json({ error: e }, { status: 500 }) | ||
} | ||
} |
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,4 +1,4 @@ | ||
import Image from "next/image"; | ||
import Image from "next/image" | ||
|
||
export default async function Home() { | ||
return ( | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import React from "react" | ||
|
||
import Icon from "../icon/Icon" | ||
|
||
type WorkCardAvailabilityItemProps = { | ||
|
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,31 +1,24 @@ | ||
export type FetchParams = | ||
| string | ||
| string[][] | ||
| Record<string, string> | ||
| URLSearchParams | ||
| undefined; | ||
export type FetchParams = string | string[][] | Record<string, string> | URLSearchParams | undefined | ||
|
||
export type FetcherOptions = { | ||
bearerToken?: string; | ||
baseUrl: string; | ||
}; | ||
bearerToken?: string | ||
baseUrl: string | ||
} | ||
export type RequestOptions = { | ||
bearerToken?: string; | ||
baseUrl?: string; | ||
}; | ||
bearerToken?: string | ||
baseUrl?: string | ||
} | ||
export type RequestArguments = { | ||
url: string; | ||
method: "get" | "post" | "put" | "delete" | "patch"; | ||
headers: Record<string, string>; | ||
params?: FetchParams; | ||
data?: BodyType<unknown>; | ||
responseType?: string; | ||
signal?: AbortSignal; | ||
}; | ||
export type RequestCallback = ( | ||
options: RequestArguments | ||
) => RequestArguments & RequestOptions; | ||
url: string | ||
method: "get" | "post" | "put" | "delete" | "patch" | ||
headers: Record<string, string> | ||
params?: FetchParams | ||
data?: BodyType<unknown> | ||
responseType?: string | ||
signal?: AbortSignal | ||
} | ||
export type RequestCallback = (options: RequestArguments) => RequestArguments & RequestOptions | ||
|
||
export type ErrorType<TErrorData> = TErrorData; | ||
export type ErrorType<TErrorData> = TErrorData | ||
|
||
export type BodyType<TBodyData> = TBodyData; | ||
export type BodyType<TBodyData> = TBodyData |
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,5 @@ | ||
import { QueryClient } from "@tanstack/react-query"; | ||
import { cache } from "react"; | ||
import { QueryClient } from "@tanstack/react-query" | ||
import { cache } from "react" | ||
|
||
const getQueryClient = cache(() => new QueryClient()); | ||
export default getQueryClient; | ||
const getQueryClient = cache(() => new QueryClient()) | ||
export default getQueryClient |
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
"use client"; | ||
"use client" | ||
|
||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; | ||
import { useState } from "react"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query" | ||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools" | ||
import { useState } from "react" | ||
|
||
function ReactQueryProvider({ children }: React.PropsWithChildren) { | ||
const [client] = useState(new QueryClient()); | ||
const [client] = useState(new QueryClient()) | ||
|
||
return ( | ||
<QueryClientProvider client={client}> | ||
{children} | ||
<ReactQueryDevtools initialIsOpen={false} /> | ||
</QueryClientProvider> | ||
); | ||
) | ||
} | ||
|
||
export default ReactQueryProvider; | ||
export default ReactQueryProvider |
Oops, something went wrong.