From bbc506f1a4bc2b7aa59ad2787c76adcc3de45e53 Mon Sep 17 00:00:00 2001 From: Marcus Date: Mon, 30 Sep 2024 00:25:12 -0700 Subject: [PATCH] Refactor: Consolidate setQueryParam --- src/components/nav/NavBar.jsx | 2 -- src/components/nav/NavSettings.jsx | 2 -- src/state/slices/userSettings.ts | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/nav/NavBar.jsx b/src/components/nav/NavBar.jsx index f3b5d4621..e32e19f23 100644 --- a/src/components/nav/NavBar.jsx +++ b/src/components/nav/NavBar.jsx @@ -33,7 +33,6 @@ import { import { changeGameMode, getExpertMode, getGameMode } from '../../state/slices/userSettings'; import data from '../../utils/data'; import { PROFESSIONS } from '../../utils/gw2-data'; -import { PARAMS, setQueryParm } from '../../utils/queryParam'; import NavAccordion from './NavAccordion'; import NavSettings from './NavSettings'; import ReapplyTemplateDialog from './ReapplyTemplateDialog'; @@ -99,7 +98,6 @@ const Navbar = () => { // only cycles between raids and fractals const newGameMode = gamemode === 'raids' ? 'fractals' : 'raids'; - setQueryParm({ key: PARAMS.GAMEMODE, value: newGameMode }); dispatch(changeGameMode(newGameMode)); const isFractalsNew = newGameMode === 'fractals'; diff --git a/src/components/nav/NavSettings.jsx b/src/components/nav/NavSettings.jsx index b2fb25492..8897d39e8 100644 --- a/src/components/nav/NavSettings.jsx +++ b/src/components/nav/NavSettings.jsx @@ -31,7 +31,6 @@ import { getExpertMode, getGameMode, } from '../../state/slices/userSettings'; -import { PARAMS, setQueryParm } from '../../utils/queryParam'; import LanguageSelection from '../baseComponents/LanguageSelection'; import Settings from '../baseComponents/Settings'; import ReapplyTemplateDialog from './ReapplyTemplateDialog'; @@ -94,7 +93,6 @@ export default function NavSettings({ }; const changeGameModeHandler = (e) => { const newGameMode = e.target.value; - setQueryParm({ key: PARAMS.GAMEMODE, value: newGameMode }); dispatch(changeGameMode(newGameMode)); const isFractalsNew = newGameMode === 'fractals'; diff --git a/src/state/slices/userSettings.ts b/src/state/slices/userSettings.ts index 0a37b091d..ecdf70943 100644 --- a/src/state/slices/userSettings.ts +++ b/src/state/slices/userSettings.ts @@ -53,6 +53,7 @@ export const userSettingsSlice = createSlice({ }, changeGameMode: (state, action: PayloadAction) => { state.gameMode = action.payload; + setQueryParm({ key: PARAMS.GAMEMODE, value: action.payload }); }, },