Skip to content

Commit

Permalink
fix: dc latest code
Browse files Browse the repository at this point in the history
  • Loading branch information
bhoopesh369 committed Feb 16, 2024
1 parent e0859b0 commit 8e4fcac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import {
dcSimulation,
changeDcLanguage,
changeSimulationState,
changeDcCode,
} from '../../store/DailyChallenge/dailyChallenge';
import {
initializeTutorialState,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8e4fcac

Please sign in to comment.