Skip to content

Commit 0b92e01

Browse files
authored
Merge pull request #189 from AgainIoT/feature/185
Fix : handle exception during create repository
2 parents ec59dfb + cf8e426 commit 0b92e01

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/components/common/modal/FinishDialog.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from "styled-components";
22
import { COLOR } from "../../../styles/color";
33
import { useState } from "react";
4+
import { useNavigate } from "react-router-dom";
45
import { useRecoilState, useRecoilValue } from "recoil";
56
import { Box, Button, DialogContent, DialogTitle } from "@mui/material";
67
import TaskAltRoundedIcon from "@mui/icons-material/TaskAltRounded";
@@ -11,7 +12,7 @@ import {
1112
} from "../../../recoil/repoData";
1213
import { templateContent } from "../../../recoil/templateState";
1314
import { issueSelectedState } from "../../../recoil/issueState";
14-
import { modalState } from "../../../recoil/commonState";
15+
import { activeState, modalState } from "../../../recoil/commonState";
1516
import { LoadingCompleted } from "../LoadingCompleted";
1617

1718
export const FinishDialog = (props) => {
@@ -29,8 +30,11 @@ export const FinishDialog = (props) => {
2930
const readme = useRecoilValue(templateContent("readme"));
3031

3132
const [dialogValue, setDialogValue] = useRecoilState(modalState(props.type));
33+
const [activeStep, setActiveStep] = useRecoilState(activeState);
3234
const [clickDisabled, setClickDisabled] = useState(false);
3335

36+
const navigate = useNavigate();
37+
3438
async function checkDuplication() {
3539
try {
3640
const response = await axios.post(
@@ -117,8 +121,8 @@ export const FinishDialog = (props) => {
117121
}
118122

119123
const handlePost = async () => {
120-
setClickDisabled(true);
121-
if (clickDisabled) {
124+
if (!clickDisabled) {
125+
setClickDisabled(true);
122126
setLoading(true);
123127
const isUnique = await checkDuplication();
124128
if (isUnique) {
@@ -127,10 +131,15 @@ export const FinishDialog = (props) => {
127131
await postEmail();
128132
localStorage.removeItem("recoil-persist");
129133
setDialogValue(false);
134+
setLoading(false);
130135
} else {
131136
alert(
132-
`Your repository '${owner}/${repoName}' is already exists!\nPlease delete repository and try again!`,
137+
`Your repository '${owner}/${repoName}' already exists!\nPlease delete repository and try again!`,
133138
);
139+
setDialogValue(false);
140+
setLoading(false);
141+
setActiveStep(1);
142+
navigate("/step1");
134143
}
135144
}
136145
};

src/components/common/template/TemplateList.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ export function TemplateList(props) {
135135
description = reviewDescription;
136136
license = reviewLicense;
137137
}
138-
console.log(license);
139-
console.log(description);
140138
if (props.type === "contributing" || props.type === "readme") {
141139
const reulst = await axios.post(url + "/generate", {
142140
owner: owner ? owner : "owner",

0 commit comments

Comments
 (0)