diff --git a/packages/client/src/store/auth.js b/packages/client/src/store/auth.js index 9829d2e350..604da7f9ad 100644 --- a/packages/client/src/store/auth.js +++ b/packages/client/src/store/auth.js @@ -1,26 +1,13 @@ import * as API from "../api" -import { writable, get } from "svelte/store" -import { builderStore } from "./builder" -import { TableNames } from "../constants" +import { writable } from "svelte/store" const createAuthStore = () => { const store = writable(null) // Fetches the user object if someone is logged in and has reloaded the page const fetchUser = async () => { - // Fetch the first user if inside the builder - if (get(builderStore).inBuilder) { - const users = await API.fetchTableData(TableNames.USERS) - if (!users.error && users[0] != null) { - store.set(users[0]) - } - } - - // Or fetch the current user from localstorage in a real app - else { - const user = await API.fetchSelf() - store.set(user) - } + const user = await API.fetchSelf() + store.set(user) } return {