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({
|
export const API = createAPIClient({
|
||||||
attachHeaders: headers => {
|
attachHeaders: headers => {
|
||||||
// Attach app ID header from store
|
// Attach app ID header from store
|
||||||
let appId = get(store).appId
|
let appId = get(store).appId || get(overview).selectedAppId
|
||||||
if (!appId) {
|
if (appId) {
|
||||||
appId = get(overview).selectedAppId
|
headers["x-budibase-app-id"] = appId
|
||||||
}
|
}
|
||||||
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
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
import * as routify from "@roxi/routify"
|
import * as routify from "@roxi/routify"
|
||||||
import { onDestroy } from "svelte"
|
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({
|
const stopSyncing = syncURLToState({
|
||||||
urlParam: "appId",
|
urlParam: "appId",
|
||||||
stateKey: "selectedAppId",
|
stateKey: "selectedAppId",
|
||||||
|
@ -111,6 +111,10 @@
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
stopSyncing()
|
stopSyncing()
|
||||||
store.actions.reset()
|
store.actions.reset()
|
||||||
|
overview.update(state => ({
|
||||||
|
...state,
|
||||||
|
selectedAppId: null,
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue