Commit 5ad75e7c authored by Malsha Rathnasiri's avatar Malsha Rathnasiri

last changes

parent b4362afa
// export const BACKEND_URL = "http://192.168.8.103:8000" // export const BACKEND_URL = "http://192.168.8.103:8000"
import { Platform } from 'react-native' import { Platform } from 'react-native'
export const BACKEND_ADDRESS = Platform.OS == 'web' ? "http://127.0.0.1:8000" : "https://21a1-112-134-220-172.ap.ngrok.io" export const BACKEND_ADDRESS = Platform.OS == 'web' ? "http://127.0.0.1:8000" : " https://2da0-2401-dd00-10-20-c8ff-e0d9-290b-d732.ap.ngrok.io"
export const BACKEND_URL = `${BACKEND_ADDRESS}` export const BACKEND_URL = `${BACKEND_ADDRESS}`
...@@ -158,18 +158,19 @@ export default function ChatScreen({ navigation }) { ...@@ -158,18 +158,19 @@ export default function ChatScreen({ navigation }) {
// } // }
useEffect(() => { // useEffect(() => {
const interval = setInterval(() => { // const interval = setInterval(() => {
if (chatDetails) { // if (chatDetails) {
loadChats(); // loadChats();
} // }
}, 3000); // }, 3000);
return () => { // return () => {
clearInterval(interval); // clearInterval(interval);
}; // };
}, []); // }, []);
const loadChatDetails = async () => { const loadChatDetails = async () => {
console.log('loadchat detials')
await getList("users") await getList("users")
.then((res) => res.json()) .then((res) => res.json())
.then((res) => { .then((res) => {
...@@ -196,7 +197,9 @@ export default function ChatScreen({ navigation }) { ...@@ -196,7 +197,9 @@ export default function ChatScreen({ navigation }) {
return n_res; return n_res;
} }
}); });
console.log({converted})
setConversations(converted); setConversations(converted);
// //change from user and to user depending on the current user // //change from user and to user depending on the current user
// if (res[0].from_user == user_id) { // if (res[0].from_user == user_id) {
// setChatDetails(res) // setChatDetails(res)
......
// export const BACKEND_URL = "http://192.168.8.103:8000" // export const BACKEND_URL = "http://192.168.8.103:8000"
import { Platform } from 'react-native' import { Platform } from 'react-native'
export const BACKEND_ADDRESS = Platform.OS == 'web' ? "http://127.0.0.1:8000" : "https://d2e9-112-134-220-172.ap.ngrok.io" export const BACKEND_ADDRESS = Platform.OS == 'web' ? "http://127.0.0.1:8000" : "https://4369-2401-dd00-10-20-9531-45f3-1d72-774e.in.ngrok.io"
export const BACKEND_URL = `${BACKEND_ADDRESS}` export const BACKEND_URL = `${BACKEND_ADDRESS}`
...@@ -162,16 +162,16 @@ export default function ChatScreen({ navigation }) { ...@@ -162,16 +162,16 @@ export default function ChatScreen({ navigation }) {
// } // }
useEffect(() => { // useEffect(() => {
const interval = setInterval(() => { // const interval = setInterval(() => {
if (chatDetails) { // if (chatDetails) {
loadChats(); // loadChats();
} // }
}, 3000); // }, 3000);
return () => { // return () => {
clearInterval(interval); // clearInterval(interval);
}; // };
}, []); // }, []);
const loadChatDetails = async () => { const loadChatDetails = async () => {
await AsyncStorage.getItem("user_id").then((user_id) => { await AsyncStorage.getItem("user_id").then((user_id) => {
......
No preview for this file type
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