Skip to content

Commit

Permalink
Added required field check
Browse files Browse the repository at this point in the history
  • Loading branch information
namedotget committed Nov 6, 2024
1 parent 395d707 commit 37f6389
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ui/components/subscription/CitizenMetadataModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ export default function CitizenMetadataModal({
requiredChain={DEFAULT_CHAIN}
label="Submit"
action={async () => {
if (
!citizenData.name ||
citizenData.name.trim() === '' ||
!citizenData.description ||
citizenData.description.trim() === ''
) {
return toast.error('Please enter a name and bio.')
}

const accessToken = await getAccessToken()
await createSession(accessToken)
try {
Expand Down
11 changes: 10 additions & 1 deletion ui/components/subscription/TeamMetadataModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { pinBlobOrFile } from '@/lib/ipfs/pinBlobOrFile'
import { unpin } from '@/lib/ipfs/unpin'
import { createSession, destroySession } from '@/lib/iron-session/iron-session'
import cleanData from '@/lib/tableland/cleanData'
import useTeamEmail from '@/lib/team/useTeamEmail'
import deleteResponse from '@/lib/typeform/deleteResponse'
import waitForResponse from '@/lib/typeform/waitForResponse'
import { renameFile } from '@/lib/utils/files'
Expand Down Expand Up @@ -161,6 +160,7 @@ export default function TeamMetadataModal({
<div className="w-full flex items-center justify-between">
<h1 className="text-2xl font-GoodTimes ">Update Info</h1>
<button
id="close-modal"
type="button"
className="flex h-10 w-10 border-2 items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white"
onClick={() => setEnabled(false)}
Expand Down Expand Up @@ -220,6 +220,15 @@ export default function TeamMetadataModal({
requiredChain={DEFAULT_CHAIN}
label="Submit"
action={async () => {
if (
!teamData.name ||
teamData.name.trim() === '' ||
!teamData.description ||
teamData.description.trim() === ''
) {
return toast.error('Please enter a name and bio.')
}

const accessToken = await getAccessToken()
await createSession(accessToken)
try {
Expand Down

0 comments on commit 37f6389

Please sign in to comment.