diff --git a/src/components/API/API.js b/src/components/API/API.js
index 074de50..050895c 100644
--- a/src/components/API/API.js
+++ b/src/components/API/API.js
@@ -1,3 +1,5 @@
+export const API_BASE_URL = 'http://localhost:3000';
+
const API = {};
API.get = (endpoint) => callFetch(endpoint, 'GET');
diff --git a/src/components/API/useLoad.js b/src/components/API/useLoad.js
deleted file mode 100644
index 5f3feef..0000000
--- a/src/components/API/useLoad.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import {useEffect, useState} from "react";
-import API from "./API";
-
-
-const useLoad = (loadEndpoint) => {
-
- // State ----------------------
-
- const [records, setRecords] = useState([]);
- const [isLoading, setIsLoading] = useState(true);
-
- // Loader ----------------------
- const loadRecords = async (endpoint) => {
- setIsLoading(true);
- const response = await API.get(endpoint);
- if (response.isSuccess) setRecords(response.result);
- setIsLoading(false);
- };
-
- useEffect(() => {
- loadRecords(loadEndpoint);
- }, []);
-
- // return ----------------------
-
- return [records, setRecords, isLoading, loadRecords];
-};
-
-export default useLoad;
-
diff --git a/src/components/layout/TopNavbar.js b/src/components/layout/TopNavbar.js
index fffeb5e..fc70bb6 100644
--- a/src/components/layout/TopNavbar.js
+++ b/src/components/layout/TopNavbar.js
@@ -3,10 +3,6 @@ import {clearSession} from '../../hooks/SessionStore';
const TopNavbar = ({title, showBack, navigation}) => {
// Initialisation ------------
-
- const routeName = navigation.getState()?.routes?.[navigation.getState().index]?.name;
- const showLogout = routeName !== 'LoginScreen' && routeName !== 'RegisterScreen';
-
// State ----------------------
// Handlers -------------------
@@ -35,11 +31,9 @@ const TopNavbar = ({title, showBack, navigation}) => {
{title}
- {showLogout ? (
-
- Logout
-
- ) : null}
+
+ Logout
+
);
diff --git a/src/components/screens/MapScreen.js b/src/components/screens/MapScreen.js
index 97aaeb2..dcd96aa 100644
--- a/src/components/screens/MapScreen.js
+++ b/src/components/screens/MapScreen.js
@@ -1,4 +1,4 @@
-import React, {useCallback, useEffect, useMemo, useState} from 'react';
+import React, {useCallback, useEffect, useState} from 'react';
import {ActivityIndicator, StyleSheet, Text, View} from 'react-native';
import * as Location from 'expo-location';
import {Magnetometer} from 'expo-sensors';
@@ -7,7 +7,6 @@ import PlayerMapView from '../gameplay/PlayerMapView';
import useGameHook from '../../hooks/useGameHook';
import usePlayerGame from '../../hooks/usePlayerGame';
import {getSession} from '../../hooks/SessionStore';
-import Cache from '../../models/Cache';
const toHeading = ({x, y}) => {
const angle = Math.atan2(y, x) * (180 / Math.PI);
@@ -28,20 +27,8 @@ const MapScreen = () => {
const [cacheRecords, setCacheRecords] = useState([]);
const [error, setError] = useState('');
- const activeCaches = useMemo(() => (
- cacheRecords.map((cache) => new Cache(
- cache.id,
- cache.coordinates.latitude,
- cache.coordinates.longitude,
- cache.radius,
- cache.clue,
- cache.groupId,
- cache.subgroupId,
- ))
- ), [cacheRecords]);
-
const subgroupFilter = session.currentSGid;
- const {visibleCache, isClaiming, setIsClaiming} = usePlayerGame(userLocation, heading, activeCaches);
+ const {visibleCache, isClaiming, setIsClaiming} = usePlayerGame(userLocation, heading, cacheRecords);
// Handlers -------------------
diff --git a/src/hooks/dbLink.js b/src/hooks/dbLink.js
deleted file mode 100644
index 5ad9594..0000000
--- a/src/hooks/dbLink.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const API_BASE_URL = 'http://localhost:3000';
-
-export default API_BASE_URL;
diff --git a/src/hooks/useAuthHook.js b/src/hooks/useAuthHook.js
index ec7aff4..9b82f5b 100644
--- a/src/hooks/useAuthHook.js
+++ b/src/hooks/useAuthHook.js
@@ -1,6 +1,5 @@
import {useState} from 'react';
-import API from '../components/API/API';
-import API_BASE_URL from './dbLink';
+import API, {API_BASE_URL} from '../components/API/API';
import {clearSession, setSessionUser} from './SessionStore';
const useAuthHook = () => {
diff --git a/src/hooks/useGameHook.js b/src/hooks/useGameHook.js
index 7a36e8c..8e84831 100644
--- a/src/hooks/useGameHook.js
+++ b/src/hooks/useGameHook.js
@@ -1,5 +1,4 @@
-import API from '../components/API/API';
-import API_BASE_URL from './dbLink';
+import API, {API_BASE_URL} from '../components/API/API';
const useGameHook = () => {
// Initialisation ------------
@@ -59,12 +58,6 @@ const useGameHook = () => {
return response.isSuccess ? response.result : null;
};
- const getMapPoints = async (gid, sgid = null) => {
- let url = `${gameDataEndpoint}/${gid}/caches`;
- if (sgid !== null) url += `?SGid=${sgid}`;
- const response = await API.get(url);
- return response.isSuccess ? response.result : [];
- };
const getCaches = async (gid, sgid = null) => {
let url = `${gameDataEndpoint}/${gid}/caches`;
@@ -108,7 +101,6 @@ const useGameHook = () => {
getTeam,
createTeam,
joinTeamByCode,
- getMapPoints,
getCaches,
upsertCache,
claimCache,
diff --git a/src/models/Cache.js b/src/models/Cache.js
deleted file mode 100644
index b1598d5..0000000
--- a/src/models/Cache.js
+++ /dev/null
@@ -1,17 +0,0 @@
-class Cache {
- constructor(id, latitude, longitude, radius, clue, groupId, subgroupId) {
- this.id = id;
- this.coordinates = { latitude, longitude };
- this.radius = radius;
- this.clue = clue;
- this.groupId = groupId;
- this.subgroupId = subgroupId;
- }
-
- toJSON() {
- return { ...this };
- }
-}
-
-export default Cache;
-