From 8e4fcace70cdf2de9f99791e2be1a9bec9c52b4c Mon Sep 17 00:00:00 2001 From: Bhoopesh Date: Fri, 16 Feb 2024 23:38:35 +0530 Subject: [PATCH] fix: dc latest code --- src/pages/Dashboard/Dashboard.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pages/Dashboard/Dashboard.tsx b/src/pages/Dashboard/Dashboard.tsx index bafc2d0..43ddaf3 100644 --- a/src/pages/Dashboard/Dashboard.tsx +++ b/src/pages/Dashboard/Dashboard.tsx @@ -76,6 +76,7 @@ import { dcSimulation, changeDcLanguage, changeSimulationState, + changeDcCode, } from '../../store/DailyChallenge/dailyChallenge'; import { initializeTutorialState, @@ -207,6 +208,19 @@ export default function Dashboard(): JSX.Element { if (err instanceof ApiError) Toast.error(err.message); }) .finally(() => localStorage.setItem('firstTime', 'false')); + codeAPI + .getLatestCode(CodeType.DailyChallenge) + .then(res => { + dispatch( + changeDcCode({ + currentUserCode: res.code, + currentUserLanguage: res.language, + }), + ); + }) + .catch(err => { + if (err instanceof ApiError) Toast.error(err.message); + }); codeAPI .getLatestCode(CodeType.Pvp)