2020-06-09 23:41:08 +02:00
|
|
|
import client from "../client";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
status: async () => {
|
|
|
|
|
const response = await client.get('/api/user/status');
|
|
|
|
|
return response.data;
|
2020-06-10 15:15:00 +02:00
|
|
|
},
|
|
|
|
|
login: async data => {
|
2020-09-03 19:14:52 +02:00
|
|
|
const response = await client.post('/api/login', data);
|
2020-06-10 15:15:00 +02:00
|
|
|
return response.data;
|
2020-06-13 17:03:14 +02:00
|
|
|
},
|
|
|
|
|
logout: async () => {
|
|
|
|
|
const response = await client.get('/api/logout');
|
|
|
|
|
return response.data;
|
2020-08-02 20:22:53 +02:00
|
|
|
},
|
|
|
|
|
list: async () => {
|
|
|
|
|
const response = await client.get('/api/user/list');
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
add: async (user) => {
|
|
|
|
|
const response = await client.post('/api/user/add', user);
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
delete: async (username) => {
|
|
|
|
|
const response = await client.post('/api/user/remove', JSON.stringify({username}));
|
|
|
|
|
return response.data;
|
2021-01-14 03:48:01 +01:00
|
|
|
},
|
|
|
|
|
changePassword: async data => {
|
2024-07-13 18:13:49 +02:00
|
|
|
const response = await client.post('/api/user/password', data).catch(err => window.flash(err.response.data, "red"));
|
2021-01-14 03:48:01 +01:00
|
|
|
return response.data;
|
2020-06-09 23:41:08 +02:00
|
|
|
}
|
|
|
|
|
}
|