mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
Refactor database interaction to use centralized API; update game type retrieval and cache management logic (minor changes lol)
This commit is contained in:
1 parent
17ed120ce8
commit
d67522a71d
8 files changed
+104
-641
No files matched your search
@@ -40,13 +40,13 @@ const MapScreen = () => {
|
||||
const subgroupFilter = session.currentSGid;
|
||||
const { visibleCache, isClaiming, setIsClaiming } = usePlayerGame(userLocation, heading, activeCaches);
|
||||
|
||||
const loadCaches = useCallback(() => {
|
||||
const loadCaches = useCallback(async () => {
|
||||
if (!session.currentGid) {
|
||||
setCacheRecords([]);
|
||||
return;
|
||||
}
|
||||
const rows = getCaches(session.currentGid, subgroupFilter);
|
||||
setCacheRecords(rows);
|
||||
const rows = await getCaches(session.currentGid, subgroupFilter);
|
||||
setCacheRecords(rows || []);
|
||||
}, [getCaches, session.currentGid, subgroupFilter]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -99,18 +99,18 @@ const MapScreen = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleClaim = (cacheId) => {
|
||||
const handleClaim = async (cacheId) => {
|
||||
if (!session.currentGid) {
|
||||
return;
|
||||
}
|
||||
claimCache({
|
||||
await claimCache({
|
||||
gid: session.currentGid,
|
||||
cacheId,
|
||||
uid: session.currentUid,
|
||||
tid: session.currentTid,
|
||||
});
|
||||
setIsClaiming(false);
|
||||
loadCaches();
|
||||
await loadCaches();
|
||||
};
|
||||
|
||||
if (!session.currentGid) {
|
||||
|
||||
Reference in new issue
Block a user