Skip to content

Commit

Permalink
include fake user_id in connect configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetised committed Dec 1, 2022
1 parent 0153777 commit 7f7e9e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import { ElectricProvider, useElectric, useElectricQuery } from 'electric-sql/re
import config from '../electric-config'

const worker = new Worker("./worker.js", { type: "module" });
const user_id = "shared-user-id"

export const ElectrifiedExample = () => {
const [ db, setDb ] = useState<ElectrifiedDatabase>()

useEffect(() => {
const init = async () => {
const SQL = await initElectricSqlJs(worker, {locateFile: (file: string) => `/${file}`})
const electrified = await SQL.openDatabase('example.db', config)
const electrified = await SQL.openDatabase('example.db', {...config, token: user_id})

setDb(electrified)
}
Expand Down

0 comments on commit 7f7e9e3

Please sign in to comment.