Skip to content

Commit

Permalink
Merge pull request #181 from AgainIoT/feature/178
Browse files Browse the repository at this point in the history
Fix : complete button is activated only for the first click
  • Loading branch information
ymw0407 authored Oct 28, 2023
2 parents 321946b + 3ac7cf6 commit 1f18423
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/components/common/modal/FinishDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const FinishDialog = (props) => {
const readme = useRecoilValue(templateContent("readme"));

const [dialogValue, setDialogValue] = useRecoilState(modalState(props.type));
const [clickDisabled, setClickDisabled] = useState(false);

async function checkDuplication() {
try {
Expand Down Expand Up @@ -116,19 +117,21 @@ export const FinishDialog = (props) => {
}

const handlePost = async () => {
const isUnique = await checkDuplication();

if (isUnique) {
setClickDisabled(true);
if (clickDisabled) {
setLoading(true);
await postCreatRepo();
await postRepoData();
await postEmail();
localStorage.removeItem("recoil-persist");
setDialogValue(false);
} else {
alert(
`Your repository '${owner}/${repoName}' is already exists!\nPlease delete repository and try again!`,
);
const isUnique = await checkDuplication();
if (isUnique) {
await postCreatRepo();
await postRepoData();
await postEmail();
localStorage.removeItem("recoil-persist");
setDialogValue(false);
} else {
alert(
`Your repository '${owner}/${repoName}' is already exists!\nPlease delete repository and try again!`,
);
}
}
};

Expand Down

0 comments on commit 1f18423

Please sign in to comment.