-
Notifications
You must be signed in to change notification settings - Fork 225
/
Copy pathauth-service.js
42 lines (33 loc) · 1.07 KB
/
auth-service.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import HttpService from "./htttp.service";
class AuthService {
// authEndpoint = process.env.API_URL;
login = async (payload) => {
const loginEndpoint = 'login';
return await HttpService.post(loginEndpoint, payload);
};
register = async (credentials) => {
const registerEndpoint = 'register';
return await HttpService.post(registerEndpoint, credentials);
};
logout = async () => {
const logoutEndpoint = 'logout';
return await HttpService.post(logoutEndpoint);
};
forgotPassword = async (payload) => {
const forgotPassword = 'password-forgot';
return await HttpService.post(forgotPassword, payload);
}
resetPassword = async (credentials) => {
const resetPassword = 'password-reset';
return await HttpService.post(resetPassword, credentials);
}
getProfile = async() => {
const getProfile = 'me';
return await HttpService.get(getProfile);
}
updateProfile = async (newInfo) => {
const updateProfile = "me";
return await HttpService.patch(updateProfile, newInfo);
}
}
export default new AuthService();