Fix for #10403 - when app overview loads, sometimes old store doesn't get a valid app ID.
This commit is contained in:
parent
dfe28d171c
commit
14545729ac
|
@ -5,12 +5,16 @@ import {
|
||||||
} from "@budibase/frontend-core"
|
} from "@budibase/frontend-core"
|
||||||
import { store } from "./builderStore"
|
import { store } from "./builderStore"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import { auth } from "./stores/portal"
|
import { auth, overview } from "./stores/portal"
|
||||||
|
|
||||||
export const API = createAPIClient({
|
export const API = createAPIClient({
|
||||||
attachHeaders: headers => {
|
attachHeaders: headers => {
|
||||||
// Attach app ID header from store
|
// Attach app ID header from store
|
||||||
headers["x-budibase-app-id"] = get(store).appId
|
let appId = get(store).appId
|
||||||
|
if (!appId) {
|
||||||
|
appId = get(overview).selectedAppId
|
||||||
|
}
|
||||||
|
headers["x-budibase-app-id"] = appId
|
||||||
|
|
||||||
// Add csrf token if authenticated
|
// Add csrf token if authenticated
|
||||||
const user = get(auth).user
|
const user = get(auth).user
|
||||||
|
|
Loading…
Reference in New Issue