diff --git a/.DS_Store b/.DS_Store
index bb3702d5..0f65b3f9 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/mobile-ui/app.json b/mobile-ui/app.json
index 6274d58f..8e0ed902 100644
--- a/mobile-ui/app.json
+++ b/mobile-ui/app.json
@@ -17,7 +17,16 @@
"**/*"
],
"ios": {
- "supportsTablet": true
+ "supportsTablet": true,
+ "infoPlist": {
+ "NSAppTransportSecurity": {
+ "NSAllowsArbitraryLoads" : true,
+ "NSAllowsArbitraryLoadsForMedia": true,
+ "NSAllowsArbitraryLoadsInWebContent": true,
+ "NSExceptionAllowsInsecureHTTPLoads": true
+ }
+ },
+ "bundleIdentifier": "1.1.0"
},
"android": {
"adaptiveIcon": {
diff --git a/mobile-ui/components/LogIn.js b/mobile-ui/components/LogIn.js
index 8320d19c..2978e5fb 100644
--- a/mobile-ui/components/LogIn.js
+++ b/mobile-ui/components/LogIn.js
@@ -1,4 +1,4 @@
-import React from "react";
+import React, {useState} from "react";
import Cookies from 'universal-cookie';
import {
Text,
@@ -19,88 +19,75 @@ 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
- },
+// const handleChange = (value) => {
+// console.log(value);
- 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}) {
+
+ const [email, setEmail] = useState();
+ const [password, setPassword] = useState();
+ // const [inputs, setInputs] = useState();
+
+ const iniciarSesion = async () => {
+
+ console.log(email);
+
+ const userData = {
+ email: "lalo@lalo.com",
+ password: '65bbb27d640914c507e5af778eccf3d1'
+ }
+
+ console.log(userData);
+ // const userData = JSON.stringify(FormControl.toString);
+ // console.log(userData);
+
+ try {
+
+ await fetch(baseURL, {
+ cache: 'no-cache',
+ method: 'POST',
+ body: JSON.stringify(userData),
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ })
+ .then(response => {
+ if (response.status != 201){
+ console.log('ocurrio un error ');
+ }else{
+ return response.json();
+ }
+ })
+ .then( response => {
+
+ // inqulino 4 y guarda 63
+ 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 == '4'){
+
+
+
+
+
+ navigation.navigate('Comunicados')
+ }else if(user.user_type == '3'){
+
+ }
+ })
+
+ } catch (error) {
+ console.log("ERROR: " +error);
+ }
+
+
+ }
+
return (
@@ -144,15 +131,15 @@ export default function LogIn({navigation}) {
-
+ setEmail(value) } />
- Contraseña
+ Contraseña
-
+ setPassword(value)} />
);
-
-
-}
\ No newline at end of file
+}
+
+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: {
+
+ }
+})
\ No newline at end of file