Skip to content

Commit

Permalink
fix(hook): body unusable error due to multiple event resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
rishikanthc committed Oct 19, 2024
1 parent f1a871a commit ebbcf06
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ export const configuration: Handle = async ({ event, resolve }) => {
const collections = await event.locals.pb.collections.getFullList();
const hasSettings = collections.some(collection => collection.name === 'settings');

if (hasSettings || event.url.pathname.endsWith('/wizard')) {
resolve(event);
if (hasSettings || event.url.pathname.endsWith('/wizard') || event.url.pathname.startsWith('/api/')) {
console.log(event.url.pathname)
return resolve(event);
} else {
throw redirect(307, '/wizard');
}

// Resolve event if no issues
return resolve(event);
};

export const handle = sequence(authentication, configuration);

0 comments on commit ebbcf06

Please sign in to comment.