function()

in src/dispatch/static/dispatch/src/api.js [50:126]


  function (err) {
    if (err.response) {
      if (err.response.status == 401) {
        if (authProviderSlug === "dispatch-auth-provider-basic") {
          router.push({ name: "BasicLogin" })
        } else {
          router.go()
        }
      }

      // allow us to turn off error handling where necessary
      if (
        Object.prototype.hasOwnProperty.call(err.config, "errorHandle") &&
        err.config.errorHandle === false
      ) {
        return Promise.reject(err)
      }

      if (err.response.status == 403) {
        let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
        store.commit(
          "notification_backend/addBeNotification",
          {
            text: errorText,
            type: "exception",
          },
          { root: true }
        )
      }

      if (err.response.status == 409) {
        let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
        store.commit(
          "notification_backend/addBeNotification",
          {
            text: errorText,
            type: "exception",
          },
          { root: true }
        )
      }

      if (err.response.status == 422) {
        let errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
        store.commit(
          "notification_backend/addBeNotification",
          {
            text: errorText,
            type: "exception",
          },
          { root: true }
        )
      }

      if (err.response.status == 500) {
        let errorText = ""
        if (err.response.data.detail) {
          errorText = err.response.data.detail.map(({ msg }) => msg).join(" ")
        }

        if (errorText.length == 0) {
          errorText =
            "Something has gone wrong. Please, retry or let your admin know that you received this error."
        }

        store.commit(
          "notification_backend/addBeNotification",
          {
            text: errorText,
            type: "exception",
          },
          { root: true }
        )
      }
      return Promise.reject(err)
    }
  }