Discord Bot Modal (Registration Form) Sending problem

I am trying to register a user and make them fill a form and save that data into a userSchema and if the user is already registered then show they are registered but i am getting the following error when i log

Submitted Data: { components: undefined, fields: undefined }

apparently the data is not being saved and fields too i dont know why

here is the code for the /register command

Line 95-97

for (const [key, value] of Object.entries(collectedInteractions.fields)) {
  submittedData[key] = value.value;

collectedInteractions.fields is accessing fields of ModalSubmitInteraction
Transforming with Object.entries yields [["components", ActionRowModalData[]],["fields", Collection<string, ModalActionRowComponent>]]
Now you attempt to access value of the values which don’t have it. Thus undefined.

1 Like

Oh now ive change the code

So now my data is being saved into database but the form on discord is not submiting it shows something went wrong but the form doesnt close but still i get the scuess message on my discord channel

here is the updated code