43 lines
954 B
JavaScript
43 lines
954 B
JavaScript
import BaseApiService from './BaseApiService';
|
|
|
|
export default class UserService extends BaseApiService {
|
|
constructor() {
|
|
super('/api/users');
|
|
}
|
|
|
|
async getUsers(params = {}) {
|
|
return this.get('', params);
|
|
}
|
|
|
|
async createUser(userData) {
|
|
return this.post('', userData);
|
|
}
|
|
|
|
async updateUser(id, userData) {
|
|
return this.put(`/${id}`, userData);
|
|
}
|
|
|
|
async deleteUser(id) {
|
|
return this.delete(`/${id}`);
|
|
}
|
|
|
|
async getUserProfile() {
|
|
return this.get('/profile');
|
|
}
|
|
|
|
async updateProfile(profileData) {
|
|
return this.put('/profile', profileData);
|
|
}
|
|
|
|
async updateAvatar(formData) {
|
|
return this.upload('/profile/avatar', formData);
|
|
}
|
|
|
|
async changePassword(passwordData) {
|
|
return this.post('/profile/change-password', passwordData);
|
|
}
|
|
|
|
async batchDelete(ids) {
|
|
return this.post('/batch-delete', { ids });
|
|
}
|
|
}
|