From f5d17ffcb6d09e8f3498ad50952b688f3729901e Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Thu, 28 Nov 2024 01:43:33 +0100
Subject: Remove `alertd` service

Revert of 5ee7d92
---
 app/(tabs)/index.tsx | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

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

diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx
index 9fff8f8..f4ff0ea 100644
--- a/app/(tabs)/index.tsx
+++ b/app/(tabs)/index.tsx
@@ -348,18 +348,28 @@ export default function HomeScreen() {
       }
 
       const response = await fetch(
-        `${process.env.EXPO_PUBLIC_ALERTD_URL}`,
+        `${process.env.EXPO_PUBLIC_API_URL}`,
         {
           method: "POST",
           headers: {
+            Authorization: `Bearer ${token}`,
             "Content-Type": "application/json",
           },
           body: JSON.stringify({
-            latitude: coords.latitude,
-            longitude: coords.longitude,
-            login: token,
-            uid: userId,
-            movingActivity,
+            query: `
+            mutation NewPosition($input: PositionInput!) {
+              newPosition(input: $input) {
+                id userId createdAt latitude longitude movingActivity
+              }
+            }
+            `,
+            variables: {
+              input: {
+                latitude: coords.latitude,
+                longitude: coords.longitude,
+                movingActivity,
+              },
+            },
           }),
         },
       );
-- 
cgit v1.2.3-18-g5258

