diff options
| author | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-12 23:09:20 +0100 |
|---|---|---|
| committer | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-12 23:09:20 +0100 |
| commit | 4b6be9f09ff56dfae1c719cb744f2312e11be317 (patch) | |
| tree | 35ea43304a32dc47ed1a7289052d1b97fca944dd /src/services/NotifyErrorService.js | |
| parent | 10abd20260050174dd508038f0b95c5f8f740933 (diff) | |
| download | lom_frontend-4b6be9f09ff56dfae1c719cb744f2312e11be317.tar.gz lom_frontend-4b6be9f09ff56dfae1c719cb744f2312e11be317.zip | |
add group maker
Diffstat (limited to 'src/services/NotifyErrorService.js')
| -rw-r--r-- | src/services/NotifyErrorService.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/services/NotifyErrorService.js b/src/services/NotifyErrorService.js new file mode 100644 index 0000000..b28e664 --- /dev/null +++ b/src/services/NotifyErrorService.js | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | import Vue from 'vue' | ||
| 2 | |||
| 3 | const error_notify = (error) => { | ||
| 4 | for (const [key, values] of Object.entries(error.response.data)) { | ||
| 5 | console.log(values) | ||
| 6 | values.forEach(value => { | ||
| 7 | Vue.notify({ | ||
| 8 | type: 'error', | ||
| 9 | title: value, | ||
| 10 | text: (key !== 'non_field_errors') ? key : '' | ||
| 11 | }) | ||
| 12 | }) | ||
| 13 | } | ||
| 14 | return { | ||
| 15 | data: error.response.data, | ||
| 16 | status: error.response.status | ||
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | export default error_notify | ||
