Skip to content

Commit

Permalink
one wallet can craete many brands
Browse files Browse the repository at this point in the history
  • Loading branch information
devsisingh committed Jun 27, 2024
1 parent af20459 commit 6756389
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/app/create-brand/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,18 @@ function getNumber() public view returns (uint256) {

if (imageUrl !== '') {
setLoading(true)
const res = await fetch(`${apiUrl}/users/all`)
// const res = await fetch(`${apiUrl}/users/all`)

if (!res.ok) {
throw new Error('Network response was not ok');
}
// if (!res.ok) {
// throw new Error('Network response was not ok');
// }

const result = await res.json();
console.log(result);
// const result = await res.json();
// console.log(result);

const addressExists = result.some((user: { wallet_address: string | undefined }) => user.wallet_address === account.address);
// const addressExists = result.some((user: { wallet_address: string | undefined }) => user.wallet_address === account.address);

if (!addressExists) {
// if (!addressExists) {
const brandId = uuidv4()
const response = await fetch(`${apiUrl}/brands`, {
method: 'POST',
Expand Down Expand Up @@ -310,9 +310,9 @@ function getNumber() public view returns (uint256) {
// }
}
}
}else{
toast.warning('With one address only one Brand can be created')
}
// }else{
// toast.warning('With one address only one Brand can be created')
// }

} else if (!imageError && imageUrl === '') {
toast.warning('Wait for your image to finish upload')
Expand Down

0 comments on commit 6756389

Please sign in to comment.