diff --git a/src/components/settings-components/SettingsView.vue b/src/components/settings-components/SettingsView.vue index 48ad9f64..14ecb785 100644 --- a/src/components/settings-components/SettingsView.vue +++ b/src/components/settings-components/SettingsView.vue @@ -302,8 +302,8 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider'; if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) { return "Checking for new releases"; } - if (this.$store.state.tsMods.connectionError.length > 0) { - return "Error getting new mods: " + this.$store.state.tsMods.connectionError; + if (this.$store.state.tsMods.thunderstoreModListUpdateError.length > 0) { + return "Error getting new mods: " + this.$store.state.tsMods.thunderstoreModListUpdateError; } if (this.$store.state.tsMods.modsLastUpdated !== undefined) { return "Cache date: " + moment(this.$store.state.tsMods.modsLastUpdated).format("MMMM Do YYYY, h:mm:ss a"); @@ -317,12 +317,12 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider'; } this.$store.commit("tsMods/startThunderstoreModListUpdate"); - this.$store.commit("tsMods/setConnectionError", ""); + this.$store.commit("tsMods/setThunderstoreModListUpdateError", ""); try { await this.refreshThunderstoreModList(); } catch (e) { - this.$store.commit("tsMods/setConnectionError", e); + this.$store.commit("tsMods/setThunderstoreModListUpdateError", e); } finally { this.$store.commit("tsMods/finishThunderstoreModListUpdate"); } diff --git a/src/store/modules/TsModsModule.ts b/src/store/modules/TsModsModule.ts index 1b0c6321..0d6710b1 100644 --- a/src/store/modules/TsModsModule.ts +++ b/src/store/modules/TsModsModule.ts @@ -19,12 +19,12 @@ export interface CachedMod { interface State { cache: Map; - connectionError: string; deprecated: Map; exclusions?: string[]; isThunderstoreModListUpdateInProgress: boolean; mods: ThunderstoreMod[]; modsLastUpdated?: Date; + thunderstoreModListUpdateError: string; } type ProgressCallback = (progress: number) => void; @@ -49,8 +49,6 @@ export const TsModsModule = { state: (): State => ({ cache: new Map(), - /*** Error shown on UI after manual mod list refresh fails */ - connectionError: '', deprecated: new Map(), /*** Packages available through API that should be ignored by the manager */ exclusions: undefined, @@ -59,7 +57,9 @@ export const TsModsModule = { /*** All mods available through API for the current active game */ mods: [], /*** When was the mod list last refreshed from the API? */ - modsLastUpdated: undefined + modsLastUpdated: undefined, + /*** Error shown on UI after manual mod list refresh fails */ + thunderstoreModListUpdateError: '' }), getters: >{ @@ -119,11 +119,11 @@ export const TsModsModule = { mutations: >{ reset(state: State) { state.cache = new Map(); - state.connectionError = ''; state.deprecated = new Map(); state.exclusions = undefined; state.mods = []; state.modsLastUpdated = undefined; + state.thunderstoreModListUpdateError = ''; }, clearModCache(state) { state.cache.clear(); @@ -131,14 +131,6 @@ export const TsModsModule = { finishThunderstoreModListUpdate(state) { state.isThunderstoreModListUpdateInProgress = false; }, - setConnectionError(state, error: string|unknown) { - if (typeof error === 'string') { - state.connectionError = error; - } else { - const msg = error instanceof Error ? error.message : "Unknown error"; - state.connectionError = msg; - } - }, setMods(state, payload: ThunderstoreMod[]) { state.mods = payload; }, @@ -148,6 +140,14 @@ export const TsModsModule = { setExclusions(state, payload: string[]) { state.exclusions = payload; }, + setThunderstoreModListUpdateError(state, error: string|unknown) { + if (typeof error === 'string') { + state.thunderstoreModListUpdateError = error; + } else { + const msg = error instanceof Error ? error.message : "Unknown error"; + state.thunderstoreModListUpdateError = msg; + } + }, startThunderstoreModListUpdate(state) { state.isThunderstoreModListUpdateInProgress = true; },