mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
Add initial JSON data files and implement core page components for game functionality
This commit is contained in:
1 parent
81847a9188
commit
ca27f8d6ed
54 files changed
+2424
-250
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
approveAdminAccess,
|
||||
createPrivateGame,
|
||||
requestAdminAccess,
|
||||
updateGroupSettings,
|
||||
} from '../API/API';
|
||||
import { getSession, setSessionGroup } from '../Model/SessionStore';
|
||||
|
||||
const useAdminViewModel = () => {
|
||||
const createGame = async (payload) => {
|
||||
const { currentUid } = getSession();
|
||||
const group = await createPrivateGame({ ...payload, userId: currentUid });
|
||||
setSessionGroup(group.Gid, 0);
|
||||
return group;
|
||||
};
|
||||
const requestAdmin = async (payload) => requestAdminAccess(payload);
|
||||
const approveAdmin = async (payload) => approveAdminAccess(payload);
|
||||
const setTeamsEnabled = async (gid, teamsEnabled) => updateGroupSettings({ gid, teamsEnabled });
|
||||
|
||||
return {
|
||||
createGame,
|
||||
requestAdmin,
|
||||
approveAdmin,
|
||||
setTeamsEnabled,
|
||||
};
|
||||
};
|
||||
|
||||
export default useAdminViewModel;
|
||||
|
||||
Reference in new issue
Block a user