update: axios installed

parent a832ff6e
......@@ -2516,6 +2516,14 @@
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz",
"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": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz",
......@@ -4142,6 +4150,11 @@
"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": {
"version": "2.1.0",
"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 { Formik } from 'formik';
import { Entypo } from '@expo/vector-icons';
import { MaterialIcons } from '@expo/vector-icons';
import { Ionicons } from '@expo/vector-icons';
import axios from 'axios'
export function SignUp({ navigation }) {
return (
......@@ -13,10 +14,22 @@ export function SignUp({ navigation }) {
<Formik
initialValues={{ name: '', email: '', password: '', district: '' }}
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>
<Text style={styles.heading}> Sign Up </Text>
......@@ -31,8 +44,8 @@ export function SignUp({ navigation }) {
<TextInput
style={styles.input}
placeholder='Name'
onChangeText={props.handleChange('name')}
value={props.values.title}
onChangeText={handleChange('name')}
value={values.name}
/>
</View>
</View>
......@@ -43,8 +56,8 @@ export function SignUp({ navigation }) {
<TextInput
style={styles.input}
placeholder='Email'
onChangeText={props.handleChange('email')}
value={props.values.title}
onChangeText={handleChange('email')}
value={values.email}
/>
</View>
</View>
......@@ -57,8 +70,8 @@ export function SignUp({ navigation }) {
style={styles.input}
multiline
placeholder='Password'
onChangeText={props.handleChange('password')}
value={props.values.body}
onChangeText={handleChange('password')}
value={values.password}
/>
</View>
</View>
......@@ -70,14 +83,14 @@ export function SignUp({ navigation }) {
<TextInput
style={styles.input}
placeholder='District'
onChangeText={props.handleChange('district')}
value={props.values.rating}
onChangeText={handleChange('district')}
value={values.district}
/>
</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>
</TouchableOpacity>
</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