This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { View } from 'react-native'; | |
import { Button } from '../components/common/'; | |
export default class LoggedIn extends Component { | |
constructor(props){ | |
super(props); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snip | |
class Login extends Component { | |
constructor(props){ | |
# code omitted | |
this.loginUser = this.loginUser.bind(this); | |
this.onLoginFail = this.onLoginFail.bind(this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#snip | |
class Registration extends Component { | |
constructor(props){ | |
# code omitted | |
this.registerUser = this.registerUser.bind(this); | |
this.onRegistrationFail = this.onRegistrationFail.bind(this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snip | |
import axios from 'axios'; | |
import deviceStorage from '../services/deviceStorage'; | |
class Login extends Component { | |
constructor(props){ | |
super(props); | |
this.state = { | |
email: '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snip | |
axios.post("http://localhost:4000/api/v1/sign_up",{ | |
user: { | |
email: email, | |
password: password, | |
password_confirmation: password_confirmation | |
} | |
},) | |
.then((response) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snip | |
whichForm() { | |
if(!this.state.showLogin){ | |
return( | |
<Registration newJWT={this.props.newJWT} authSwitch={this.authSwitch} /> | |
); | |
} else { | |
return( | |
<Login newJWT={this.props.newJWT} authSwitch={this.authSwitch} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snip | |
export default class App extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
jwt: '', | |
loading: true | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, Fragment } from 'react'; | |
import { View, Text } from 'react-native'; | |
import { Input, TextLink, Loading, Button } from './common'; | |
import axios from 'axios'; | |
import deviceStorage from '../services/deviceStorage'; # Import deviceStorage :) | |
# snip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snip | |
const deviceStorage = { | |
async saveItem(key, value) { | |
try { | |
await AsyncStorage.setItem(key, value); | |
} catch (error) { | |
console.log('AsyncStorage Error: ' + error.message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AsyncStorage } from 'react-native'; | |
const deviceStorage = { | |
// our AsyncStorage functions will go here :) | |
}; | |
export default deviceStorage; |