Browse Source

added sending pin through homescreen

Ricardo-gonzalez32 2 years ago
parent
commit
523fb8a7c6

+ 3
- 2
MocionesIUPI/screens/HomeScreen.js View File

9
     // this connects us to the API and fetches the json file with the mociones
9
     // this connects us to the API and fetches the json file with the mociones
10
     const getMociones = async () => {
10
     const getMociones = async () => {
11
        try {
11
        try {
12
-        const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website 
12
+        const response = await fetch('http://10.0.0.66:5000/send?PIN=121071'); // connection to the website 
13
         const json = await response.json();
13
         const json = await response.json();
14
   
14
   
15
         // setting the content of each category 
15
         // setting the content of each category 
23
     }
23
     }
24
 
24
 
25
     const pressHandler = () => {
25
     const pressHandler = () => {
26
-        navigation.navigate('Pinpage')
26
+        navigation.navigate('Pinpage', {Pin:PIN},)
27
     }
27
     }
28
     
28
     
29
     useEffect(() => {
29
     useEffect(() => {
35
             <Text style = {globalStyles.tittleText}>Home Screen</Text>
35
             <Text style = {globalStyles.tittleText}>Home Screen</Text>
36
             <Button title='Ir a pagina de pin' onPress={pressHandler} />
36
             <Button title='Ir a pagina de pin' onPress={pressHandler} />
37
         </View>
37
         </View>
38
+
38
         
39
         
39
         
40
         
40
 
41
 

+ 1
- 1
MocionesIUPI/screens/MocionScreen.js View File

11
       // this connects us to the API and fetches the json file with the mociones
11
       // this connects us to the API and fetches the json file with the mociones
12
       const getMociones = async () => {
12
       const getMociones = async () => {
13
         try {
13
         try {
14
-         const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website 
14
+         const response = await fetch('http://10.0.0.66:5000/send?PIN=121071'); // connection to the website 
15
          const json = await response.json();
15
          const json = await response.json();
16
    
16
    
17
          // setting the content of each category 
17
          // setting the content of each category 

+ 3
- 2
MocionesIUPI/screens/PincodeScreen.js View File

3
 import { globalStyles } from "../styles/global";
3
 import { globalStyles } from "../styles/global";
4
 import SmoothPinCodeInput from 'react-native-smooth-pincode-input';
4
 import SmoothPinCodeInput from 'react-native-smooth-pincode-input';
5
 
5
 
6
-const pin = 123456;
6
+
7
+
7
 
8
 
8
 export default class App extends React.Component {
9
 export default class App extends React.Component {
9
     
10
     
19
     pinInput = React.createRef();
20
     pinInput = React.createRef();
20
   
21
   
21
     _checkCode = (code) => {
22
     _checkCode = (code) => {
22
-      if (code != pin) {
23
+      if (code != this.props.navigation.state.params.Pin) {
23
         this.pinInput.current.shake()
24
         this.pinInput.current.shake()
24
           .then(() => this.setState({ code: '' }));
25
           .then(() => this.setState({ code: '' }));
25
       } else {
26
       } else {