Skip to content

Commit

Permalink
Merge pull request #66 from fc5y/huynhnhan.ngo/fix/handle-get-time
Browse files Browse the repository at this point in the history
Handle backdoor for getTime
  • Loading branch information
hnngo authored Oct 10, 2020
2 parents 3e1ea60 + 35865a8 commit a56fe59
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/shared/context/ContestInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@ export function ContestInfoProvider({ children }) {

React.useEffect(() => {
const getContestTime = async () => {
// eslint-disable-next-line prefer-const
let { data, error } = await apiGetTime();
data.countdownOpen = -1;
if (error || !data) {
setContestInfo({ ...contestInfo, isContestReady: false, isFetched: true });
} else if (data.countdownOpen <= 0) {
setContestInfo({ ...contestInfo, isContestReady: true, isFetched: true });
} else {
setContestInfo({ ...contestInfo, isContestReady: false, isFetched: true });
}
// const { data, error } = await apiGetTime();
setContestInfo({ ...contestInfo, isContestReady: true, isFetched: true });
};

!contestInfo.isFetched && getContestTime();
Expand Down

0 comments on commit a56fe59

Please sign in to comment.