-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserApi.js
More file actions
25 lines (20 loc) · 939 Bytes
/
Copy pathuserApi.js
File metadata and controls
25 lines (20 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { apiClient } from './axiosClient'
export const getUserProfileApi = () =>
apiClient.get('/users/profile').then((res) => res.data.data)
export const updateUserProfileApi = (data) => {
const formData = new FormData()
if (data.fullName) formData.append('fullName', data.fullName)
if (data.phone) formData.append('phone', data.phone)
if (data.dateOfBirth) formData.append('dateOfBirth', data.dateOfBirth)
if (data.gender) formData.append('gender', data.gender)
if (data.avatar) formData.append('avatar', data.avatar)
return apiClient.put('/users/profile', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
}).then((res) => res.data.data)
}
export const changePasswordApi = (data) =>
apiClient.post('/users/change-password', data).then((res) => res.data.data)
export const getSubscriptionHistoryApi = () =>
apiClient.get('/users/subscription-history').then((res) => res.data.data)