Skip to content

Commit

Permalink
everythibg is pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian-Kwong committed May 26, 2024
1 parent 5878f48 commit 6d987f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 4 additions & 6 deletions packages/ReverseFood/app/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import { useLocalSearchParams } from "expo-router";
import Table from "../components/table.js";
import * as SecureStore from "expo-secure-store";
import { useEffect, useState } from "react";

import { get } from "react-native/Libraries/TurboModule/TurboModuleRegistry.js";
import { params } from "../components/FoodInput.js";
const URL = "http:/10.144.207.193:3000/image";




export default info = () => {
const [myData , setData] = useState({ name : "Loading", description : "Loading", foodCategory : "Loading", ingredients : "Loading", nutrients : []})


async function fetchData () { await SecureStore.getItemAsync("token").then((token) => {
const params = useLocalSearchParams();
if (token === undefined) {
console.log("No token found");
}
Expand Down Expand Up @@ -51,8 +49,8 @@ export default info = () => {
}})};

useEffect(() => {
fetchData().then((data) => {setData({
name : data.name, description : (data.name === undefined), foodCategory : data.foodCategory, ingredients : data.ingredients, nutrients : data.nutrients
fetchData().then((data) => {setData({
name : data.name, description : data.name, foodCategory : data.foodCategory, ingredients : data.ingredients, nutrients : data.nutrients
})}).catch((error) => console.log(error))
;}, []);

Expand Down
8 changes: 7 additions & 1 deletion packages/ReverseFood/components/FoodInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ function swutchPages(image, foodName, ingredients, desc){
router.push({pathname: "info", params: {image: image, foodName: foodName, ingredients: ingredients, description: desc}})
}

export var params = {
image: "",
foodName: "",
ingredients: "",
description: "",
}

export default function FoodInput() {
const [image, setImage] = useState(null);
Expand Down Expand Up @@ -74,7 +80,7 @@ export default function FoodInput() {
value={desc}
></TextInput>
</View>
<Button title="Submit" onPress={()=>swutchPages(image,foodName,ingredients,desc)}/>
<Button title="Submit" onPress={()=> { params = {image,foodName,ingredients,desc} ; swutchPages(image,foodName,ingredients,desc)}}/>
</View>
);
}
Expand Down

0 comments on commit 6d987f6

Please sign in to comment.