Skip to content

Commit

Permalink
chore: fix loading database from current path
Browse files Browse the repository at this point in the history
  • Loading branch information
younes200 committed Jun 15, 2024
1 parent d350194 commit ecbb326
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions db/drizzle.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { type SQLJsDatabase, drizzle } from "drizzle-orm/sql-js";
import initSqlJs from "sql.js";
import { useDatabase } from "./provider";
import { useEffect, useReducer } from "react";
import { habitTable } from "./schema";

export const initialize = async (): Promise<SQLJsDatabase> => {
const sqlPromise = initSqlJs({
locateFile: (file) => `https://sql.js.org/dist/${file}`,
});
const dataPromise = fetch("/database.sqlite").then((res) =>
const dataPromise = fetch("./database.sqlite").then((res) =>
res.arrayBuffer(),
);
const [SQL, buf] = await Promise.all([sqlPromise, dataPromise]);
Expand Down

0 comments on commit ecbb326

Please sign in to comment.