@@ -26,9 +26,7 @@ import {version} from '../../package.json'
2626
2727import Communications from 'react-native-communications'
2828import * as c from '../components/colors'
29- import {
30- loadLoginCredentials ,
31- } from '../../lib/login'
29+ import CookieManager from 'react-native-cookies'
3230
3331
3432export default class SettingsView extends React . Component {
@@ -38,8 +36,7 @@ export default class SettingsView extends React.Component {
3836 }
3937
4038 state = {
41- username : '' ,
42- password : '' ,
39+ loggedIn : false ,
4340 success : false ,
4441 loading : false ,
4542 attempted : false ,
@@ -49,17 +46,10 @@ export default class SettingsView extends React.Component {
4946 this . loadData ( )
5047 }
5148
52- _usernameInput : any ;
53- _passwordInput : any ;
54-
5549 loadData = async ( ) => {
56- let [ creds , status ] = await Promise . all ( [
57- loadLoginCredentials ( ) ,
50+ let [ status ] = await Promise . all ( [
5851 AsyncStorage . getItem ( 'credentials:valid' ) . then ( val => JSON . parse ( val ) ) ,
5952 ] )
60- if ( creds ) {
61- this . setState ( { username : creds . username , password : creds . password } )
62- }
6353 if ( status ) {
6454 this . setState ( { success : true } )
6555 }
@@ -73,19 +63,17 @@ export default class SettingsView extends React.Component {
7363 }
7464
7565 logOut = async ( ) => {
76- // this.props.navigator.push({
77- // id: 'SISLoginView',
78- // index: this.props.route.index + 1,
79- // })
80- }
81-
82- focusUsername = ( ) => {
83- console . log ( this . _usernameInput )
84- this . _usernameInput . focus ( )
85- }
86-
87- focusPassword = ( ) => {
88- this . _passwordInput . focus ( )
66+ this . setState ( { loading : true } )
67+ CookieManager . clearAll ( ( err , res ) => {
68+ if ( err ) {
69+ console . log ( err )
70+ }
71+ console . log ( res )
72+ this . setState ( {
73+ success : false ,
74+ loading : false ,
75+ } )
76+ } )
8977 }
9078
9179 onPressLegalButton ( ) {
@@ -110,9 +98,6 @@ export default class SettingsView extends React.Component {
11098 }
11199
112100 render ( ) {
113- let username = this . state . username
114- let password = this . state . password
115-
116101 let loggedIn = this . state . success
117102 let loading = this . state . loading
118103
0 commit comments