Skip to content

Commit

Permalink
chore: test some hook restructuring
Browse files Browse the repository at this point in the history
-> the hello local worked, but the githubuser local didn't
  • Loading branch information
xynydev committed Apr 20, 2024
1 parent 5345d00 commit a3c8c7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export const handle: Handle = async ({ event, resolve }) => {
Authorization: `Bearer ${githubToken}`
}
});
const githubUser = await githubUserResponse.json();
if (githubUserResponse.ok) {
const githubUser = await githubUserResponse.json();
event.locals.githubUser = githubUser;
} else {
event.locals.githubUser = null;
}

event.locals.hello = "world";

return resolve(event);
return await resolve(event);
};
3 changes: 1 addition & 2 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export async function load({ locals, parent }) {
await parent();
export async function load({ locals }) {
return {
githubUser: locals.githubUser,
hello: locals.hello
Expand Down

0 comments on commit a3c8c7b

Please sign in to comment.