new signup
This commit is contained in:
parent
90bfb2e978
commit
2c1df94e27
@ -17,7 +17,7 @@ export default class SignUp extends React.Component<any, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async signUpFunction() {
|
async signUpFunction() {
|
||||||
fetch('https://notifysync.simailadjalim.fr/user', {
|
const signInResponse = await fetch('https://notifysync.simailadjalim.fr/user', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
@ -28,6 +28,22 @@ export default class SignUp extends React.Component<any, any> {
|
|||||||
password: this.state.password
|
password: this.state.password
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
const signInJson = await signInResponse.json();
|
||||||
|
if (signInJson.status == "ok"){
|
||||||
|
const loginResponse = await fetch('https://notifysync.simailadjalim.fr/user', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
username: this.state.username,
|
||||||
|
password: this.state.password
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
const loginJson = await loginResponse.json();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUsername(event: any) {
|
updateUsername(event: any) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user