Browse Source

add other db url to use from other devices

Bernadette Elena Hammerle 3 năm trước cách đây
mục cha
commit
b6b74f5edb
1 tập tin đã thay đổi với 7 bổ sung4 xóa
  1. 7 4
      src/helpers/dbHelpers.js

+ 7 - 4
src/helpers/dbHelpers.js

@@ -1,5 +1,8 @@
+const serverUrl = "http://192.168.8.101:5000"
+//const serverUrl = "http://localhost:5000"
+
 export const fetchPathKeys = () => {
-  return fetch("http://localhost:5000/get-path")
+  return fetch(serverUrl + "/get-path")
     .then(res => {
       if(res.status >= 400) {
         throw new Error("Server responds with error!");
@@ -14,7 +17,7 @@ export const fetchPathKeys = () => {
 
 
 export const fetchPaths = () => {
-  return fetch("http://localhost:5000/get-path")
+  return fetch(serverUrl + "/get-path")
     .then(res => {
       if(res.status >= 400) {
           throw new Error("Server responds with error!");
@@ -48,7 +51,7 @@ export function savePathToDb(){
     body: json
   }
 
-  return fetch("http://localhost:5000/set-path", reqOptions)
+  return fetch(serverUrl + "/set-path", reqOptions)
     .then(res => {
       if(res.status >= 400) {
           throw new Error("Server responds with error!");
@@ -71,7 +74,7 @@ export function saveTimeToDb(data){
     body: json
   }
 
-  return fetch("http://localhost:5000/set-time", reqOptions)
+  return fetch(serverUrl + "/set-time", reqOptions)
     .then(res => {
       if(res.status >= 400) {
         console.log(res.text)