Skip to content

Commit

Permalink
fix(wizard): issue with first boot
Browse files Browse the repository at this point in the history
  • Loading branch information
rishikanthc committed Oct 19, 2024
1 parent 00a11b4 commit 1c2d7c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export const authentication: Handle = async ({ event, resolve }) => {
};

export const configuration: Handle = async ({event, resolve}) => {
await ensureCollectionExists(event.locals.pb);
const settings = await event.locals.pb.collection('settings').getList(1,1);

console.log(settings)
const condition = (settings.items.length <= 0) || settings.items?.wizard

if (!settings.items[0].wizard && !event.url.pathname.endsWith('/wizard') && !event.url.pathname.startsWith('/api/')) {
if (condition && !event.url.pathname.endsWith('/wizard') && !event.url.pathname.startsWith('/api/')) {
// If the wizard is not completed, redirect to /wizard
console.log("Redirecting to wizard <-------------");
throw redirect(307, '/wizard');
Expand Down
2 changes: 2 additions & 0 deletions src/lib/wizardQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fs from 'fs';
import path from 'path';
import PocketBase from 'pocketbase';
import { env } from '$env/dynamic/private';
import { ensureCollectionExists } from '$lib/fileFuncs';

// Create the queue
export const wizardQueue = new Queue('wizardQueue', {
Expand Down Expand Up @@ -127,6 +128,7 @@ const worker = new Worker(
'wizardQueue',
async (job) => {
console.log("hello world from wizard")
ensureCollectionExists(pb);
let modelPath;
let cmd;
try {
Expand Down

0 comments on commit 1c2d7c1

Please sign in to comment.