forked from transform1234/alt-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentResetPasswordAPI.jsx
47 lines (40 loc) · 1006 Bytes
/
StudentResetPasswordAPI.jsx
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
43
44
45
46
47
import axios from "axios";
import { studentReset } from "../routes/links";
const studentResetPasswordAPI = async (username, password) => {
console.log("INSIDE RESET PASS API");
console.log(username, password);
const token = localStorage.getItem("token");
const headers = {
"Accept-Language": "en-GB,en;q=0.9",
Authorization: `Bearer ${token}`,
Connection: "keep-alive",
"Content-Type": "application/json",
};
const jsonData = {
username: username,
newPassword: password,
};
let result;
await axios({
method: "POST",
url: studentReset,
data: jsonData,
headers: headers,
})
.then((res) => {
console.log(res);
console.log(res.data);
console.log(res.data.statusCode);
if (res.data.statusCode === 200) {
result = true;
} else {
result = false;
}
})
.catch(function (error) {
let err = 0;
return err;
});
return result;
};
export default studentResetPasswordAPI;