GabrielTrettel
3 years ago
3 changed files with 50 additions and 21 deletions
@ -1,20 +1,43 @@ |
|||
import { create } from "apisauce"; |
|||
import authClient from "../auth/authClient"; |
|||
|
|||
/*const login = (name, password) => |
|||
authClient.post(`/login?username=${name}&password=${password}`);*/ |
|||
function login(name, password) { |
|||
// NOTE: Change to API in future
|
|||
if (name !== "1199998888" || password !== "qwertyui") { |
|||
return { |
|||
ok: false, |
|||
}; |
|||
return authClient.post(`/login?username=${name}&password=${password}`); |
|||
} |
|||
return { |
|||
ok: true, |
|||
data: |
|||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiVXN1w6FyaW8gVGVzdGUiLCJlbWFpbCI6InVzdWFyaW9AdGVzdGUuY29tLmJyIiwiaW5zdGl0dXRpb25OYW1lIjoiRS4gRS4gVmljZW50ZSBMZXBvcmFjZSIsImluc3RpdHV0aW9uVHlwZSI6IkVzY29sYSIsIklEIjoiMSJ9.dk-Nl5VLvAWhT_JUYREpJYYCc98s71SyHJwmwH55ZS4", |
|||
}; |
|||
|
|||
function signup({ |
|||
name, |
|||
number, |
|||
password, |
|||
dateofborn, |
|||
confirmPassword, |
|||
institutionName, |
|||
gender, |
|||
state, |
|||
city, |
|||
institution, |
|||
secQuestion, |
|||
secQuestionAns, |
|||
consent, |
|||
}) { |
|||
const body = JSON.stringify({ |
|||
username: number, |
|||
nickname: name, |
|||
password: password, |
|||
dateofborn: dateofborn, |
|||
gender: gender, |
|||
state: state, |
|||
city: city, |
|||
institutiontype: institution, |
|||
institution: institutionName, |
|||
securityquestion: secQuestion, |
|||
securityanswer: secQuestionAns, |
|||
termsofusage: consent, |
|||
roles: ["ROLE_CLIENT"], |
|||
}); |
|||
|
|||
console.log(body); |
|||
|
|||
return authClient.post(`/signup`, body); |
|||
} |
|||
|
|||
export default login; |
|||
export { login, signup }; |
@ -1,7 +1,7 @@ |
|||
import { create } from "apisauce"; |
|||
|
|||
const authClient = create({ |
|||
baseURL: "http://191.233.193.200:8080/users", |
|||
baseURL: "http://wpd.brazilsouth.cloudapp.azure.com:8080/users", |
|||
}); |
|||
|
|||
export default authClient; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue