Skip to content

Commit

Permalink
feat(report): input validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Me1e committed Aug 1, 2023
1 parent 2777d4f commit 9eb823f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions packages/nextjs/pages/report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ function CreateNFTWhenContractExist() {
});

async function Write() {
if (type === 0) {
alert("Please select type");
return;
}
if (files.length === 0) {
alert("Please upload image");
return;
}
if (name === "") {
alert("Please input name");
return;
}
if (description === "") {
alert("Please input description");
return;
}

setIsLoading(true);
console.log("ipfs start");
const cid = await handleIpfs();
Expand Down Expand Up @@ -143,8 +160,8 @@ function CreateNFTWhenContractExist() {
},
error => {
console.warn("Fail to fetch current location", error);
setLat(37);
setLng(127);
setLat(37.567267);
setLng(127.009475);
},
{
enableHighAccuracy: false,
Expand Down Expand Up @@ -237,7 +254,7 @@ function CreateNFTWhenContractExist() {
inputProps={{
id: "uncontrolled-native",
}}
label="재난 종류"
label="Disaster type"
value={type}
onChange={handleType}
>
Expand Down

0 comments on commit 9eb823f

Please sign in to comment.