Skip to content
This repository has been archived by the owner on Jan 9, 2022. It is now read-only.

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaiwat10 committed Apr 18, 2021
1 parent c230be6 commit e877c06
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 166 deletions.
5 changes: 0 additions & 5 deletions .next/build-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
"static/chunks/webpack.js",
"static/chunks/main.js",
"static/chunks/pages/_error.js"
],
"/next/dist/pages/_error": [
"static/chunks/webpack.js",
"static/chunks/main.js",
"static/chunks/pages/next/dist/pages/_error.js"
]
},
"ampFirstPages": []
Expand Down
4 changes: 1 addition & 3 deletions .next/server/pages-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
"/_app": "pages/_app.js",
"/_error": "pages/_error.js",
"/_document": "pages/_document.js",
"/next/dist/pages/_error": "pages/next/dist/pages/_error.js",
"/": "pages/index.js",
"/api": "pages/api.js"
"/": "pages/index.js"
}
56 changes: 33 additions & 23 deletions .next/server/pages/index.js

Large diffs are not rendered by default.

145 changes: 79 additions & 66 deletions .next/static/chunks/pages/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .next/static/chunks/webpack.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .next/static/development/_buildManifest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 24 additions & 13 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@ function Home(): React.ReactNode {
const [success, setSuccess] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);

useEffect(() => {
if (value) {
setTouched(true);
}

setIsValid(verifyEthAddress(value));
}, [value]);

const onSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
await requestFunds();
};

const getContractBalance = async () => {
try {
const { data } = await axios.get('/api');
Expand All @@ -48,6 +35,30 @@ function Home(): React.ReactNode {
setLoading(false);
};

const onSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();

if (!isValid) {
return setError('Invalid wallet address.');
}

await requestFunds();
};

useEffect(() => {
if (value) {
setTouched(true);
}

setIsValid(verifyEthAddress(value));
}, [value]);

useEffect(() => {
if (!isValid) {
setError('');
}
}, [value]);

useEffect(() => {
getContractBalance();
}, []);
Expand Down
53 changes: 0 additions & 53 deletions test/counter.ts

This file was deleted.

0 comments on commit e877c06

Please sign in to comment.