Эх сурвалжийг харах

Adding an api call for check score

Kirk Trombley 5 жил өмнө
parent
commit
0bd86059b4

+ 14 - 0
client/src/domain/apiMethods.js

@@ -88,3 +88,17 @@ export const sendGuess = async (gameId, playerId, round, point) => {
     }
     return await res.json();
 }
+
+export const checkScore = async (point1, point2) => {
+    const res = await fetch(`${API_BASE}/score`, {
+        method: "POST",
+        headers: {
+            "Content-Type": "application/json",
+        },
+        body: JSON.stringify({ point1, point2 }),
+    });
+    if (!res.ok) {
+        throw Error(res.statusText);
+    }
+    return await res.json();
+}