update: axios installed

parent a832ff6e
...@@ -2516,6 +2516,14 @@ ...@@ -2516,6 +2516,14 @@
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz",
"integrity": "sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA==" "integrity": "sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA=="
}, },
"axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"requires": {
"follow-redirects": "^1.14.0"
}
},
"babel-plugin-dynamic-import-node": { "babel-plugin-dynamic-import-node": {
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
...@@ -4142,6 +4150,11 @@ ...@@ -4142,6 +4150,11 @@
"path-exists": "^4.0.0" "path-exists": "^4.0.0"
} }
}, },
"follow-redirects": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz",
"integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw=="
},
"fontfaceobserver": { "fontfaceobserver": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fontfaceobserver/-/fontfaceobserver-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fontfaceobserver/-/fontfaceobserver-2.1.0.tgz",
......
import React from 'react'; import React, {useState, useEffect} from 'react';
import { StyleSheet, Button, TextInput, View, Text, TouchableOpacity, ImageBackground } from 'react-native'; import { StyleSheet, Button, TextInput, View, Text, TouchableOpacity, ImageBackground } from 'react-native';
import { Formik } from 'formik'; import { Formik } from 'formik';
import { Entypo } from '@expo/vector-icons'; import { Entypo } from '@expo/vector-icons';
import { MaterialIcons } from '@expo/vector-icons'; import { MaterialIcons } from '@expo/vector-icons';
import { Ionicons } from '@expo/vector-icons'; import { Ionicons } from '@expo/vector-icons';
import axios from 'axios'
export function SignUp({ navigation }) { export function SignUp({ navigation }) {
return ( return (
...@@ -13,10 +14,22 @@ export function SignUp({ navigation }) { ...@@ -13,10 +14,22 @@ export function SignUp({ navigation }) {
<Formik <Formik
initialValues={{ name: '', email: '', password: '', district: '' }} initialValues={{ name: '', email: '', password: '', district: '' }}
onSubmit={(values) => { onSubmit={(values) => {
console.log(values); // console.log(values);
axios.post('http://127.0.0.1:5000/users', {
name: values.name,
email: values.email,
password: values.password,
district: values.district
})
.then(function (response){
console.log(response)
})
.catch(function(error){
console.log(error)
})
}} }}
> >
{props => ( {({handleChange, handleSubmit, values}) => (
<View> <View>
<Text style={styles.heading}> Sign Up </Text> <Text style={styles.heading}> Sign Up </Text>
...@@ -31,8 +44,8 @@ export function SignUp({ navigation }) { ...@@ -31,8 +44,8 @@ export function SignUp({ navigation }) {
<TextInput <TextInput
style={styles.input} style={styles.input}
placeholder='Name' placeholder='Name'
onChangeText={props.handleChange('name')} onChangeText={handleChange('name')}
value={props.values.title} value={values.name}
/> />
</View> </View>
</View> </View>
...@@ -43,8 +56,8 @@ export function SignUp({ navigation }) { ...@@ -43,8 +56,8 @@ export function SignUp({ navigation }) {
<TextInput <TextInput
style={styles.input} style={styles.input}
placeholder='Email' placeholder='Email'
onChangeText={props.handleChange('email')} onChangeText={handleChange('email')}
value={props.values.title} value={values.email}
/> />
</View> </View>
</View> </View>
...@@ -57,8 +70,8 @@ export function SignUp({ navigation }) { ...@@ -57,8 +70,8 @@ export function SignUp({ navigation }) {
style={styles.input} style={styles.input}
multiline multiline
placeholder='Password' placeholder='Password'
onChangeText={props.handleChange('password')} onChangeText={handleChange('password')}
value={props.values.body} value={values.password}
/> />
</View> </View>
</View> </View>
...@@ -70,14 +83,14 @@ export function SignUp({ navigation }) { ...@@ -70,14 +83,14 @@ export function SignUp({ navigation }) {
<TextInput <TextInput
style={styles.input} style={styles.input}
placeholder='District' placeholder='District'
onChangeText={props.handleChange('district')} onChangeText={handleChange('district')}
value={props.values.rating} value={values.district}
/> />
</View> </View>
</View> </View>
<View> <View>
<TouchableOpacity style={styles.buttonSub} title="Sign Up" onPress={props.handleSubmit} > <TouchableOpacity style={styles.buttonSub} title="Sign Up" onPress={handleSubmit} >
<Text style={styles.buttonText}>Sign Up</Text> <Text style={styles.buttonText}>Sign Up</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment