Removing the unauthenticated middleware

This commit is contained in:
Cody Jackson 2024-04-30 12:10:10 -07:00
parent 9ea4e37fd4
commit 6f7c29626c
7 changed files with 9 additions and 36 deletions

View File

@ -2,9 +2,8 @@
import Brand from '@shell/mixins/brand';
export default {
name: 'NuxtError',
mixins: [Brand],
middleware: ['unauthenticated'],
name: 'NuxtError',
mixins: [Brand],
data() {
return { ready: false };

View File

@ -1,7 +1,3 @@
<script>
export default { middleware: ['unauthenticated'] };
</script>
<template>
<router-view :key="$route.path" />
</template>

View File

@ -4,8 +4,7 @@ import FixedBanner from '@shell/components/FixedBanner';
export default {
mixins: [Brand],
components: { FixedBanner },
middleware: ['unauthenticated'],
components: { FixedBanner }
};
</script>

View File

@ -6,7 +6,4 @@ middleware['authenticated'] = middleware['authenticated'].default || middleware[
middleware['i18n'] = require('../middleware/i18n.js');
middleware['i18n'] = middleware['i18n'].default || middleware['i18n'];
middleware['unauthenticated'] = require('../middleware/unauthenticated.js');
middleware['unauthenticated'] = middleware['unauthenticated'].default || middleware['unauthenticated'];
export default middleware;

View File

@ -6,7 +6,6 @@ import { applyProducts } from '@shell/store/type-map';
import { findBy } from '@shell/utils/array';
import { ClusterNotFoundError, RedirectToError } from '@shell/utils/error';
import { get } from '@shell/utils/object';
import { setFavIcon, haveSetFavIcon } from '@shell/utils/favicon';
import dynamicPluginLoader from '@shell/pkg/dynamic-plugin-loader';
import { AFTER_LOGIN_ROUTE, WORKSPACE } from '@shell/store/prefs';
import { BACK_TO } from '@shell/config/local-storage';
@ -91,11 +90,6 @@ export default async function({
// Load settings, which will either be just the public ones if not logged in, or all if you are
await fetchInitialSettings(store);
// Set the favicon - use custom one from store if set
if (!haveSetFavIcon()) {
setFavIcon(store);
}
const res = store.getters['management/byId'](MANAGEMENT.SETTING, SETTING.FIRST_LOGIN);
const plSetting = store.getters['management/byId'](MANAGEMENT.SETTING, SETTING.PL);

View File

@ -1,18 +0,0 @@
import { setFavIcon, haveSetFavIcon } from '@shell/utils/favicon';
import { fetchInitialSettings } from '@shell/utils/settings';
export default async function({ store }) {
if (haveSetFavIcon()) {
return;
}
try {
// Load settings, which will either be just the public ones if not logged in, or all if you are
fetchInitialSettings(store)
// Don't block everything on fetching settings, just update when they come in
.then(() => {
// Set the favicon - use custom one from store if set
setFavIcon(store);
});
} catch (e) {}
}

View File

@ -4,6 +4,7 @@ import { SETTING } from '@shell/config/settings';
import { createCssVars } from '@shell/utils/color';
import { setTitle } from '@shell/config/private-label';
import { fetchInitialSettings } from '@shell/utils/settings';
import { setFavIcon, haveSetFavIcon } from '@shell/utils/favicon';
const cspAdaptorApp = ['rancher-csp-adapter', 'rancher-csp-billing-adapter'];
@ -23,6 +24,11 @@ export default {
// Ensure we read the settings even when we are not authenticated
try {
await fetchInitialSettings(this.$store);
// The favicon is implicitly dependent on the initial settings having already been fetched
if (!haveSetFavIcon()) {
setFavIcon(this.$store);
}
} catch (e) {}
// Setting this up front will remove `computed` churn, and we only care that we've initialised them