summaryrefslogtreecommitdiffstats
path: root/src/services/NotifyErrorService.js
blob: b28e664cb3410aff4d4cd411b2f7bd510e5c27fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Vue from 'vue'

const error_notify = (error) => {
    for (const [key, values] of Object.entries(error.response.data)) {
        console.log(values)
        values.forEach(value => {
            Vue.notify({
                type: 'error',
                title: value,
                text: (key !== 'non_field_errors') ? key : ''
            })
        })
    }
    return {
        data: error.response.data,
        status: error.response.status
    }
}

export default error_notify