Skip to content

Commit

Permalink
LoginView의 login 기능 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
onting committed Jul 22, 2020
1 parent 2249408 commit e73e536
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions compo/loginview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StyleSheet, Text, View, TextInput, Button, TouchableHighlight } from 'react-native';
import { StyleSheet, Text, View, TextInput, Button, TouchableHighlight, Alert } from 'react-native';
import hostaddr from '../config'

export default function LoginView(props) {
Expand All @@ -15,10 +15,34 @@ export default function LoginView(props) {
username: username,
password: password
}),
})
.then(res => res.text())
.then(text => console.log(text))
}).then(res => {
if(!res.ok){
Alert.alert(
'로그인 실패',
'아이디와 비밀번호를 확인해주세요',
[
{
text: '닫기',
style: 'cancle',
},
],
{cancelable: false},
);
}
return res.text();
}).then(text => console.log(text))
.catch((err) => {
Alert.alert(
'로그인 실패',
String(err),
[
{
text: '닫기',
style: 'cancle',
},
],
{cancelable: false},
);
console.log(err);
});
}
Expand Down

0 comments on commit e73e536

Please sign in to comment.