corda-checkers/webapp/src/api/user.js
djmil df431eb4f1 UUIDprops
- guide.selectedUUID is used to determina current uuid
- all the game related midifications are stored independantly per UUID
- no global indicators
2023-11-24 10:38:52 +01:00

21 lines
494 B
JavaScript

import { usePolling } from "../hook/api";
import { useUserStateReducer } from "../reducer/user";
export default function useUserApi() {
const [state, dispatchState] = useUserStateReducer();
const useGetUser = () => {
const onSuccess = (userJson) => {
dispatchState({ type: "parse", userJson });
}
usePolling('/api/user', { onSuccess }); // <<-- fetch once
}
return {
state,
api : {
useGetUser
}
}
}