Skip to content

Commit af39076

Browse files
committed
refactor: updateVirtualContestItemsの返り値をboolean型に修正
1 parent 31f984a commit af39076

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

atcoder-problems-frontend/src/pages/Internal/VirtualContest/ContestUpdatePage.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface Request {
2222
penalty_second: number;
2323
}
2424

25-
interface OuterProps {
25+
interface Props {
2626
contestId: string;
2727
}
2828

@@ -33,13 +33,13 @@ const createAndUpdateContest = async (
3333
const response = await updateVirtualContestInfo(request).then(() =>
3434
updateVirtualContestItems(request.id, problems)
3535
);
36-
return response.status;
36+
return response.status === 200;
3737
};
3838

39-
export const ContestUpdatePage = (props: OuterProps) => {
39+
export const ContestUpdatePage = (props: Props) => {
4040
const { contestId } = props;
4141
const contestResponse = useVirtualContest(contestId);
42-
const [updateResponse, setUpdateResponse] = React.useState<number>();
42+
const [updateResponse, setUpdateResponse] = React.useState<boolean>();
4343
if (!contestResponse.data && !contestResponse.error) {
4444
return <Spinner style={{ width: "3rem", height: "3rem" }} />;
4545
} else if (contestResponse.error || !contestResponse.data) {
@@ -49,7 +49,7 @@ export const ContestUpdatePage = (props: OuterProps) => {
4949
const contestInfo = contestResponse.data.info;
5050
const contestProblems = contestResponse.data.problems;
5151

52-
if (updateResponse === 200) {
52+
if (updateResponse) {
5353
return <Redirect to={`/contest/show/${contestId}`} />;
5454
}
5555

0 commit comments

Comments
 (0)