From 4b6be9f09ff56dfae1c719cb744f2312e11be317 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sun, 12 Dec 2021 23:09:20 +0100 Subject: add group maker --- src/services/AuthService.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'src/services/AuthService.js') diff --git a/src/services/AuthService.js b/src/services/AuthService.js index 758157c..2f58076 100644 --- a/src/services/AuthService.js +++ b/src/services/AuthService.js @@ -1,25 +1,8 @@ import axios from "axios"; -import Vue from 'vue' +import error_notify from './NotifyErrorService.js' const url = 'http://localhost:8000/api/auth/' -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 { async login(data) { return await axios @@ -46,6 +29,19 @@ export default { }, + async info(data) { + return await axios + .get(url+'info/?'+data) + .then(res => { + return { + data: res.data, + status: res.status + } + }) + .catch(error => error_notify(error)) + + }, + async logout() { return await axios .post(url+'logout/') @@ -56,4 +52,4 @@ export default { }) .catch(error => error_notify(error)) } -} \ No newline at end of file +} -- cgit v1.2.3