updated: discount model

parent 072bc4f4
...@@ -60,6 +60,12 @@ export function BottomTab() { ...@@ -60,6 +60,12 @@ export function BottomTab() {
<Ionicons name="home" size={24} color="black" /> <Ionicons name="home" size={24} color="black" />
<Text>Home</Text> <Text>Home</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity style={styles.barButtonView}
onPress={() => navigation.navigate("PriceScreen")}
>
<Entypo name="user" size={24} color="black" />
<Text>Profile</Text>
</TouchableOpacity>
</View> </View>
); );
} }
......
...@@ -68,7 +68,7 @@ const fetchData = async () => { ...@@ -68,7 +68,7 @@ const fetchData = async () => {
{data.map((data) =>( {data.map((data) =>(
<TouchableOpacity style={styles.touchable} onPress={() => navigation.navigate('PriceScreen', {picture: data.userID.prof_img_name})}> // <TouchableOpacity style={styles.touchable} onPress={() => navigation.navigate('PriceScreen', {picture: data.userID.prof_img_name})}>
<View style={styles.card}> <View style={styles.card}>
{/* <View style={styles.left}> {/* <View style={styles.left}>
...@@ -89,7 +89,7 @@ const fetchData = async () => { ...@@ -89,7 +89,7 @@ const fetchData = async () => {
<Text >Points: {data.points}</Text> <Text >Points: {data.points}</Text>
</View> </View>
</View> </View>
</TouchableOpacity> // {/* </TouchableOpacity> */}
))} ))}
{/* ) )} */} {/* ) )} */}
......
...@@ -20,29 +20,53 @@ import { SignIn } from "./SignIn"; ...@@ -20,29 +20,53 @@ import { SignIn } from "./SignIn";
import axios from "axios"; import axios from "axios";
import { BottomTab } from "../Navigations/BottomTab"; import { BottomTab } from "../Navigations/BottomTab";
export function PriceScreen({ navigation, data, route }) { export function PriceScreen({ navigation }) {
const {picture} = route.params const [discount, setDiscount] = useState("");
useEffect(() => {
getImage(picture); // data, route
}, []); // const {picture} = route.params
// useEffect(() => {
// getImage(picture);
// }, []);
const fetchData = async () => {
// const resp = await fetch("http://192.168.8.126:5000/getDetails", {method:"POST"});
axios({
method: "GET",
url: "http://192.168.8.126:5000/discount/<id>",
})
.then(function (response) {
console.log(response.data.message);
// data = response.data
setDiscount(response.data.message);
})
.catch(function (error) {
console.log("axios error" + error);
});
};
useEffect(() => {
fetchData();
},[]);
function name() { function name() {
axios axios
} }
const [image, setImage] = useState(''); // const [image, setImage] = useState('');
//get the token and id from headers //get the token and id from headers
//from the id get the //from the id get the
const getImage = async (name) => { // const getImage = async (name) => {
console.log(name) // console.log(name)
const q = name.split(' ').join('+') // const q = name.split(' ').join('+')
const img = await fetch(`http://192.168.8.126:5000/getimage/${name}`) // const img = await fetch(`http://192.168.8.126:5000/getimage/${name}`)
const image = await img.json(); // const image = await img.json();
console.log(image) // console.log(image)
setImage(image.previewURL) // setImage(image.previewURL)
} // }
const [details, setDetails] = useState({ const [details, setDetails] = useState({
name: "", name: "",
...@@ -156,7 +180,7 @@ const getImage = async (name) => { ...@@ -156,7 +180,7 @@ const getImage = async (name) => {
<View style={styles.con}> <View style={styles.con}>
<Text> <Text>
{ {
<Image source={{ uri: `http://192.168.8.126:5000/getimage/${picture}` }} style={{ width: 200, height: 200 }} /> <Image source={{}} style={{ width: 200, height: 200 }} />
} }
</Text> </Text>
...@@ -254,7 +278,7 @@ const getImage = async (name) => { ...@@ -254,7 +278,7 @@ const getImage = async (name) => {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View> <View>
<Text style={styles.text1}>You have earned 5% Discount</Text> <Text style={styles.text1}>You have earned {discount}% Discount</Text>
</View> </View>
</View> </View>
</View> </View>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment