keanacobarde / on-paper

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

STRETCH - NEW USER NAVIGATION PROCESS #48

Open keanacobarde opened 9 months ago

keanacobarde commented 9 months ago

User Story

I, as an incoming user - who falls into any categories highlighted within the proposal of this application - will need to provide some data on startup. That being:

Acceptance Criteria

WHEN, a user who has never signed in before signs in, they should be met, immediately with a form requesting for them to supply some information. This form will request for the following:

There should also be a function that allows for the user to opt out of the form; however, this may need to be something that's implemented later.

Dependencies

N / A - All components within this issue ticket will be newly created, outside of the API calls which communicate with the FireBase. That won't be!

Dev Notes

keanacobarde commented 9 months ago

UPDATES:

keanacobarde commented 9 months ago

LOGIC FOR CHECKING THE ACCOUNT AGE:

  const checkingAccAge = () => {
    const timeDiff = parseFloat(user.metadata.b) - parseFloat(user.metadata.a);
    if (timeDiff < 2) {
      const monthsArray = [
        'January', 'February', 'March', 'April', 'May', 'June',
        'July', 'August', 'September', 'October', 'November', 'December',
      ];
      monthsArray.forEach((monthInd) => {
        const payload = {
          month: monthInd,
          year: date.toLocaleDateString('default', { year: 'numeric' }),
          earnings: 0,
          uid: user.uid,
        };
        createNewMonthlyIncome(payload).then(({ name }) => {
          const patchPayload = { firebasekey: name };
          updateIncome(patchPayload).then(console.warn);
        });
      });
    }
  };