Refactor AuthenticatedState to store displayName and uid
The AuthenticatedState interface was updated to directly store the `displayName` and `uid` properties. Previously, it stored the entire `CasContent` object, which contained these properties along with others that were not consistently used. This change simplifies the interface and reduces redundancy.
This commit is contained in:
@@ -7,7 +7,7 @@ import { State } from "$root/routes/_middleware.ts";
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
async function Courses(_request: Request, context: FreshContext<State>) {
|
||||
return <h2>Welcome to {context.state.session?.displayName}.</h2>;
|
||||
return <h2>Welcome to {context.state.displayName || 'Guest'}.</h2>;
|
||||
}
|
||||
|
||||
export const config = getPartialsConfig();
|
||||
|
||||
@@ -7,7 +7,7 @@ import { State } from "$root/routes/_middleware.ts";
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
export async function Index(_request: Request, context: FreshContext<State>) {
|
||||
return <h2>Welcome to {context.state.session?.displayName}.</h2>;
|
||||
return <h2>Welcome to {context.state.displayName || 'Guest'}.</h2>;
|
||||
}
|
||||
|
||||
export const config = getPartialsConfig();
|
||||
|
||||
@@ -7,7 +7,7 @@ import { State } from "$root/routes/_middleware.ts";
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
async function Notes(_request: Request, context: FreshContext<State>) {
|
||||
return <h2>Welcome to {context.state.session?.displayName}.</h2>;
|
||||
return <h2>Welcome to {context.state.displayName || 'Guest'}.</h2>;
|
||||
}
|
||||
|
||||
export const config = getPartialsConfig();
|
||||
|
||||
Reference in New Issue
Block a user