1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00
planka/client/src/api/users.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
import http from './http';
import socket from './socket';
/* Actions */
const getUsers = (headers) => socket.get('/users', undefined, headers);
2019-08-31 04:07:25 +05:00
const createUser = (data, headers) => socket.post('/users', data, headers);
2019-08-31 04:07:25 +05:00
const getUser = (id, headers) => socket.get(`/users/${id}`, undefined, headers);
const getCurrentUser = (headers) => socket.get('/users/me', undefined, headers);
2019-08-31 04:07:25 +05:00
const updateUser = (id, data, headers) => socket.patch(`/users/${id}`, data, headers);
2019-08-31 04:07:25 +05:00
const updateUserEmail = (id, data, headers) => socket.patch(`/users/${id}/email`, data, headers);
const updateUserPassword = (id, data, headers) =>
socket.patch(`/users/${id}/password`, data, headers);
const updateUserUsername = (id, data, headers) =>
socket.patch(`/users/${id}/username`, data, headers);
2020-04-03 00:35:25 +05:00
const updateUserAvatar = (id, data, headers) => http.post(`/users/${id}/avatar`, data, headers);
2019-08-31 04:07:25 +05:00
const deleteUser = (id, headers) => socket.delete(`/users/${id}`, undefined, headers);
2019-08-31 04:07:25 +05:00
export default {
getUsers,
createUser,
getUser,
2019-08-31 04:07:25 +05:00
getCurrentUser,
updateUser,
updateUserEmail,
updateUserPassword,
2020-04-03 00:35:25 +05:00
updateUserUsername,
2020-04-21 05:04:34 +05:00
updateUserAvatar,
2019-08-31 04:07:25 +05:00
deleteUser,
};