From 5ee7d92337197ebb09ff802f9943e9692cb88f1e Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Mon, 23 Sep 2024 10:31:38 +0200
Subject: Use alertd service

---
 app/(tabs)/index.tsx | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

(limited to 'app/(tabs)/index.tsx')

diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx
index 4168c8f..6344a22 100644
--- a/app/(tabs)/index.tsx
+++ b/app/(tabs)/index.tsx
@@ -346,33 +346,22 @@ export default function HomeScreen() {
         movingActivity = "IN_VEHICLE";
       }
 
-      const response = await fetch(
-        `${process.env.EXPO_PUBLIC_API_URL}/graphql`,
+      await fetch(
+        `${process.env.EXPO_PUBLIC_ALERTD_URL}`,
         {
           method: "POST",
           headers: {
-            Authorization: `Bearer ${token}`,
             "Content-Type": "application/json",
           },
           body: JSON.stringify({
-            query: `
-            mutation NewPosition($input: PositionInput!) {
-              newPosition(input: $input) {
-                id userId createdAt latitude longitude movingActivity
-              }
-            }
-            `,
-            variables: {
-              input: {
-                latitude: coords.latitude,
-                longitude: coords.longitude,
-                movingActivity,
-              },
-            },
+            latitude: coords.latitude,
+            longitude: coords.longitude,
+            login: token,
+            uid: userId,
+            movingActivity,
           }),
         },
       );
-      const data = await response.json();
     } catch (err) {
       console.error("Error on updating position");
     }
-- 
cgit v1.2.3-71-g8e6c

