1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Clear selected app ID from overview store when unmounting, and avoid sending up 'null' and 'undefined' string app ID headers

This commit is contained in:
Andrew Kingston 2023-04-25 08:35:25 +01:00
parent 14545729ac
commit 22d81fd858
2 changed files with 8 additions and 5 deletions

View file

@ -10,11 +10,10 @@ import { auth, overview } from "./stores/portal"
export const API = createAPIClient({
attachHeaders: headers => {
// Attach app ID header from store
let appId = get(store).appId
if (!appId) {
appId = get(overview).selectedAppId
let appId = get(store).appId || get(overview).selectedAppId
if (appId) {
headers["x-budibase-app-id"] = appId
}
headers["x-budibase-app-id"] = appId
// Add csrf token if authenticated
const user = get(auth).user

View file

@ -33,7 +33,7 @@
import * as routify from "@roxi/routify"
import { onDestroy } from "svelte"
// Keep URL and state in sync for selected screen ID
// Keep URL and state in sync for selected app ID
const stopSyncing = syncURLToState({
urlParam: "appId",
stateKey: "selectedAppId",
@ -111,6 +111,10 @@
onDestroy(() => {
stopSyncing()
store.actions.reset()
overview.update(state => ({
...state,
selectedAppId: null,
}))
})
</script>