Add API base URL and refactor imports; streamline cache handling in hooks. Replaced the DBlink.js because having just one file handle the connection is better, matches other projects. Used dblink coz i didnt know how to do it with graeme's method... sorry!

This commit is contained in:
bobbert committed 2026-04-05 18:32:42 +01:00
1 parent 9b9f13eb6a
commit 8acf4c923a
8 files changed
+9 -85

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
const API_BASE_URL = 'http://localhost:3000';
export default API_BASE_URL;
+1 -2
View File
@@ -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 = () => {
+1 -9
View File
@@ -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,