Nerds-Who-Code / Mental-Health-Tracker

mental-health-tracker.vercel.app
MIT License
5 stars 6 forks source link

Refactor repeating code on server #45

Closed steph-koopmanschap closed 1 year ago

steph-koopmanschap commented 2 years ago

Move some repeating code in mockAPI.js to util.js
In particular from the createUser and addEntry functions. util.js has 2 functions.

// This function transforms a date object to a string format. // date is a Date object. // To format today's date, input (new Date()) as the first parameter // seperator specifies the character to seperate the dates. // format can either be 3 formats and will specify in which format the date string will be returned // "YYYY-MM-DD" // "DD-MM-YYYY" // "MM-DD-YYYY" formatDateToStr

// Returns a random number in string format containing the digits 0-9, where the 1st digit is never 0. // The amount of difits is deterimined by the numLength. (Default = 32) // With numLength=32 the chance of generating an identical ID for 2 different function calls is extremely unlikely. // The lower numLength the more likely 2 identical ID's will be generated. generateID

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
mental-health-tracker ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 11, 2023 at 8:39PM (UTC)
xintamosaik commented 1 year ago

I tried to resolve merge conflicts, since I think the conflicts only hailed from CSS changes that were done in another feature.