budibase/packages/client/src/stores/org.js

30 lines
631 B
JavaScript
Raw Normal View History

import { API } from "api"
import { writable, get } from "svelte/store"
import { appStore } from "./app"
const createOrgStore = () => {
const store = writable(null)
const { subscribe, set } = store
async function init() {
const tenantId = get(appStore).application?.tenantId
if (!tenantId) return
try {
const settingsConfigDoc = await API.getTenantConfig(tenantId)
set({ logoUrl: settingsConfigDoc.config.logoUrl })
} catch (e) {
2024-01-31 14:53:53 +01:00
console.error("Could not init org ", e)
}
}
return {
subscribe,
2023-03-28 12:18:49 +02:00
actions: {
init,
},
}
}
export const orgStore = createOrgStore()