Commit a1126efc authored by Ishini Kiridena's avatar Ishini Kiridena

All practitioner view completed on the patient UI

parent 1e3fdf89
......@@ -104,14 +104,12 @@ export default function App() {
component={PatientMainChatView}
/>
<Stack.Screen
name="PatientAllPractitioners"
name="All Practitioners"
component={PatientAllPractitioners}
options={{ headerShown: false }}
/>
<Stack.Screen
name="PatientNFTRequests"
component={PatientNFTRequests}
options={{ headerShown: false }}
/>
</Stack.Navigator>
) : (
......
import React from "react";
import { View, Text, StyleSheet } from "react-native";
import React, { useEffect, useState } from "react";
import { View, Text, StyleSheet, Button } from "react-native";
import { LOCALBACKEND } from "../../env";
export default function PatientAllPractitioners({ navigation, router }) {
const [data, setData] = useState([]);
useEffect(() => {
fetchData();
});
const fetchData = async () => {
try {
const practitionerUrl = LOCALBACKEND + "/practitioner/allpractitioner";
const response = await fetch(practitionerUrl);
const json = await response.json();
setData(json.data);
} catch (error) {
console.error("Error fetching data:", error);
}
};
const renderItem = (item) => {
return (
<View key={item._id}>
<Text>Full Name: {item.fullname}</Text>
<Text>Public Key: {item.publickey}</Text>
<Text>Workspace: {item.workspace}</Text>
<Button title="Request" onPress={() => handleRequest(item)} />
</View>
);
};
const handleRequest = (item) => {
// Handle the request for the specific item by requesting the practitioner
console.log("Requested:", item);
};
return (
<View style={styles.container}>
<Text style={styles.text}>All practitioners</Text>
</View>
<View style={styles.container}>{data.map((item) => renderItem(item))}</View>
);
}
......
......@@ -27,7 +27,7 @@ export default function PatientMainChatView({ route }) {
const navigateToAllPractitioners = () => {
// Navigate to the "All practitioners" view
// Replace "AllPractitionersView" with the actual name of the view
navigation.navigate("PatientAllPractitioners");
navigation.navigate("All Practitioners");
};
const navigateToNFTRequests = () => {
......
export const AES_KEY = "QfTjWnZr4u7x!A%D";
export const LOCALBACKEND = "http://192.168.1.100:4000";
export const LOCALBACKEND = "http://192.168.8.117:4000";
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