import React from "react"; import Cookies from 'universal-cookie'; import { Text, Link, Center, Heading, VStack, Box, FormControl, Button, Image } from "native-base"; import logo from "../assets/logo-katoikia.png"; import { Entypo } from '@expo/vector-icons'; import { MaterialCommunityIcons } from '@expo/vector-icons'; import { View, TextInput, StyleSheet } from "react-native"; const baseURL = "http://localhost:4000/user/loginUser"; const cookies = new Cookies(); const styles = StyleSheet.create({ input: { height: 40, margin: 10, borderWidth: 0.5, padding: 5, flex: 1, paddingTop: 10, paddingRight: 10, paddingBottom: 10, paddingLeft: 0, marginTop: 50, marginBottom: 10, borderRadius: 4 }, iconStyle: { paddingBottom: 20, marginTop: 3, paddingTop: 35 }, viewSection: { flex: 1, flexDirection: 'row', justifyContent: 'center', alignItems: 'center', marginBottom: 28 }, container: { } }) const iniciarSesion = async() => { const userData = JSON.stringify(FormControl.toString); console.log(userData); try { await fetch(baseURL, { cache: 'no-cache', method: 'POST', body: JSON.stringify(), headers: { 'Content-Type': 'application/json' } }) .then(response => { if (response.status != 201){ console.log('ocurrio un error '); }else{ return response.json(); } }) .then( response => { const user = response.message cookies.set('id',user._id, {path: "/"} ) cookies.set('name',user.name, {path: "/"} ) cookies.set('email',user.email, {path: "/"} ) cookies.set('type',user.user_type, {path: "/"} ) if(user.user_type == '3'){ navigation.navigate('Comunicados') }else if(user.user_type == '4'){ } }) } catch (error) { } } export default function LogIn({navigation}) { return (
Katoikia logo
Bienvenido a Katoikia Su app de comunidad de confianza Correo Electrónico Contraseña navigation.navigate('Password')} > Recuperar contraseña
); }