keanacobarde / on-paper

Spend your money OnPaper first!
0 stars 0 forks source link

INPUT VALDIATION BUG #32

Closed keanacobarde closed 11 months ago

keanacobarde commented 11 months ago

Description

ONSUBMISSION CHANGES

  const handleSubmit = (e) => {
    e.preventDefault();
    if (obj.firebaseKey) {
      updateCategory(formInput).then(() => router.push(`/category/${obj.firebaseKey}`));
    } else {
//reassigning the string value of the value assigned to the key formInput.spendingLimit to a parsedFloat version.
      formInput.spendingLimit = parseFloat(formInput.spendingLimit);
      const payload = { ...formInput, uid: user.uid };
      createNewCategory(payload).then(({ name }) => {
        const patchPayload = { firebaseKey: name };
        updateCategory(patchPayload).then(() => {
          router.push(`/category/${patchPayload.firebaseKey}`);
        });
      });
    }
  };

NOTE - THIS DATA TYPE ISSUE REACHES ACROSS HOW DATA IS HANDLED ACROSS THE APPLICATION. YOU WILL HAVE TO DETERMINE HOW TO HANDLE THE DATA OF PRE-EXISTING OBJECTS, AS WELL AS ARRAY METHODS RESPONSIBLE FOR THE SUMMATION AND DISPLAY OF DATA.

Related Issue

30

12

Motivation and Context

How Can This Be Tested?

Screenshots (if appropriate):

Types of changes