Skip to content

Instantly share code, notes, and snippets.

@danLeBrown
Last active January 24, 2023 08:12
Show Gist options
  • Select an option

  • Save danLeBrown/b54986bb2f8dc5caddaadabca818a36b to your computer and use it in GitHub Desktop.

Select an option

Save danLeBrown/b54986bb2f8dc5caddaadabca818a36b to your computer and use it in GitHub Desktop.

Revisions

  1. danLeBrown revised this gist Jan 24, 2023. No changes.
  2. danLeBrown revised this gist Apr 24, 2021. No changes.
  3. danLeBrown created this gist Apr 24, 2021.
    16 changes: 16 additions & 0 deletions alert.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // this is where alert data from the server is stored
    const alertDataFromServer = []

    // this is the message relayed to the user
    const messageToPush = []

    // res.data.data (alert data) comes from the server
    alertDataFromServer.push(res.data.data)
    alertDataFromServer.forEach((element) => {
    const errorObjects = element.errors.errors
    Object.keys(errorObjects).forEach((key) => {
    obj[key].forEach((e) => {
    messageToPush.push({ message: e })
    })
    })
    return true