Clean project

This commit is contained in:
Maria Sanchez 2022-08-22 14:31:47 -06:00
parent ca6f1d1496
commit d6339121b7
3 changed files with 64 additions and 78 deletions

View File

@ -14,7 +14,6 @@ export default function Home() {
useEffect(() => { useEffect(() => {
const onRequestCommentsData = async () => { const onRequestCommentsData = async () => {
console.log("CALLED?")
setIsRequesting(true); setIsRequesting(true);
try { try {
@ -27,8 +26,6 @@ export default function Home() {
const response = await jsonResponse.json(); const response = await jsonResponse.json();
console.log(response);
setComments(response.message); setComments(response.message);
} catch (error) { } catch (error) {

View File

@ -19,12 +19,6 @@ import { UserContext } from "../context/UserContext";
import { API } from "../environment/api"; import { API } from "../environment/api";
const baseURL = `${API.BASE_URL}/user/loginUser`; const baseURL = `${API.BASE_URL}/user/loginUser`;
const cookies = new Cookies();
// const handleChange = (value) => {
// console.log(value);
// }
export default function LogIn({ navigation }) { export default function LogIn({ navigation }) {
@ -39,7 +33,6 @@ export default function LogIn({ navigation }) {
const onHandleChange = (name) => (value) => setCredentials(prev => ({ ...prev, [name]: value })) const onHandleChange = (name) => (value) => setCredentials(prev => ({ ...prev, [name]: value }))
const iniciarSesion = async () => { const iniciarSesion = async () => {
console.log(credentials)
try { try {
await fetch(baseURL, { await fetch(baseURL, {

View File

@ -1,84 +1,80 @@
import React from "react"; import React, { useContext } from "react";
import { import {
Box, Box, Button,
Heading, Center, FormControl, Heading, ScrollView, VStack
VStack, } from "native-base";
FormControl,
Button,
Center,
ScrollView
} from "native-base";
import { View, TextInput, StyleSheet } from "react-native"; import { StyleSheet, TextInput } from "react-native";
import { UserContext } from "../context/UserContext";
export default function Profile({route, navigation}){ export default function Profile({ navigation }) {
const userData = JSON.parse(JSON.stringify(route.params)); const userData = useContext(UserContext)
console.log(userData.user); console.log(userData.user);
return ( return (
<Center> <Center>
<ScrollView width='100%' h='550' ml='36' _contentContainerStyle={{ <ScrollView width='100%' h='550' ml='36' _contentContainerStyle={{
px: "20px", px: "20px",
mb: "4", mb: "4",
minW: "72" minW: "72"
}}> }}>
<Box safeArea p="2" w="90%" maxW="290" py="8"> <Box safeArea p="2" w="90%" maxW="290" py="8">
<Heading size="lg" color="coolGray.800" _dark={{ <Heading size="lg" color="coolGray.800" _dark={{
color: "warmGray.50" color: "warmGray.50"
}} fontWeight="semibold"> }} fontWeight="semibold">
Bienvenido {userData.user.name} Bienvenido {userData.user.name}
</Heading> </Heading>
<Heading mt="1" color="coolGray.600" _dark={{ <Heading mt="1" color="coolGray.600" _dark={{
color: "warmGray.200" color: "warmGray.200"
}} fontWeight="medium" size="xs"> }} fontWeight="medium" size="xs">
Modifique sus datos Modifique sus datos
</Heading> </Heading>
<VStack space={3} mt="5"> <VStack space={3} mt="5">
<FormControl> <FormControl>
<FormControl.Label>DNI</FormControl.Label> <FormControl.Label>DNI</FormControl.Label>
<TextInput type="text" defaultValue={userData.user.dni} editable='false'/> <TextInput type="text" defaultValue={userData.user.dni} editable='false' />
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Nombre</FormControl.Label> <FormControl.Label>Nombre</FormControl.Label>
<TextInput style={styles.input} type="text" defaultValue={userData.user.name}/> <TextInput style={styles.input} type="text" defaultValue={userData.user.name} />
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Apellido</FormControl.Label> <FormControl.Label>Apellido</FormControl.Label>
<TextInput style={styles.input} type="text"defaultValue={userData.user.last_name} /> <TextInput style={styles.input} type="text" defaultValue={userData.user.last_name} />
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Correo electrónico</FormControl.Label> <FormControl.Label>Correo electrónico</FormControl.Label>
<TextInput style={styles.input} type="text" defaultValue={userData.user.email}/> <TextInput style={styles.input} type="text" defaultValue={userData.user.email} />
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Contraseña actual</FormControl.Label> <FormControl.Label>Contraseña actual</FormControl.Label>
<TextInput style={styles.input} type="password" defaultValue=""/> <TextInput style={styles.input} type="password" defaultValue="" />
</FormControl> </FormControl>
<Button mt="2" backgroundColor="orange.300"> <Button mt="2" backgroundColor="orange.300">
Actualizar Actualizar
</Button> </Button>
<Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Inicio')}> <Button mt="6" colorScheme="error" onPress={() => navigation.navigate('Inicio')}>
Cerrar sesión Cerrar sesión
</Button> </Button>
</VStack> </VStack>
</Box> </Box>
</ScrollView> </ScrollView>
</Center> </Center>
) )
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
input: { input: {
height: 10, height: 10,
margin:3, margin: 3,
borderWidth: 0.5, borderWidth: 0.5,
padding: 5, padding: 5,
flex: 1, flex: 1,
@ -86,9 +82,9 @@ const styles = StyleSheet.create({
paddingRight: 19, paddingRight: 19,
paddingBottom: 20, paddingBottom: 20,
paddingLeft: 0, paddingLeft: 0,
marginTop: 6, marginTop: 6,
marginBottom:6, marginBottom: 6,
borderRadius: 4 borderRadius: 4
} }
}) })