diff --git a/src/dispatch/static/dispatch/src/app/store.js b/src/dispatch/static/dispatch/src/app/store.js index fb146a6ff101..0889dc2fcd83 100644 --- a/src/dispatch/static/dispatch/src/app/store.js +++ b/src/dispatch/static/dispatch/src/app/store.js @@ -1,7 +1,7 @@ import { getField, updateField } from "vuex-map-fields" import router from "@/router" -const getDefaulRefreshState = () => { +const getDefaultRefreshState = () => { return { show: false, message: "", @@ -11,7 +11,7 @@ const getDefaulRefreshState = () => { const state = { toggleDrawer: true, refresh: { - ...getDefaulRefreshState(), + ...getDefaultRefreshState(), }, loading: false, } @@ -46,7 +46,7 @@ const mutations = { state.loading = value }, RESET_REFRESH(state) { - state.refresh = Object.assign(state.refresh, getDefaulRefreshState()) + state.refresh = Object.assign(state.refresh, getDefaultRefreshState()) }, } diff --git a/src/dispatch/static/dispatch/src/main.js b/src/dispatch/static/dispatch/src/main.js index 2115e55643fa..20bef2c267dc 100644 --- a/src/dispatch/static/dispatch/src/main.js +++ b/src/dispatch/static/dispatch/src/main.js @@ -18,11 +18,19 @@ import VueMarkdown from "vue-markdown" // initialize the app settings before mounting the app function initialize() { - return axios.get("/api/v1/settings").then((response) => { - for (const [key, value] of Object.entries(response.data)) { - localStorage.setItem(key, value) - } - }) + // Only attempt to setup app context on full page / app reload. This is needed because + // SSO providers will likely protect the /api/v1/settings endpoint _before_ we can initialize the SSO + // libraries. On full app load the SSO flow will executed for the static files themselves and this call will succeed. + // + // On simple page refresh this is not always the case so we re-use the existing settings and do not attempt to fetch them. + + if (!localStorage.getItem("DISPATCH_AUTHENTICATION_PROVIDER_SLUG")) { + return axios.get("/api/v1/settings").then((response) => { + for (const [key, value] of Object.entries(response.data)) { + localStorage.setItem(key, value) + } + }) + } } initialize().then(() => {