Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- handleSubmit(e){
- e.preventDefault();
- if (this.state.username == ""){
- return this.addError('Prašome įvesti vartotojo vardą');
- }
- if (this.state.password == ""){
- return this.addError('Prašome įvesti slaptažodį');
- }
- fetch(config.server + '/sistemosprieinamumas/prisijungti', {
- method: "POST",
- headers: {
- "Accept": "application/json",
- "Content-Type": "application/json"
- },
- body: JSON.stringify({
- "username": this.state.username,
- "password": this.state.password
- })
- })
- .then(response => {
- if (response.status == 400){
- return this.addError('Blogi prisijungimo duomenys');
- }
- if (response.status == 200){
- return response.json();
- }
- })
- .then(response => {
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement