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:
parent
14545729ac
commit
22d81fd858
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue