1import { useCallback, useState } from 'react';
2import Maybe from 'folktale/maybe';
3import * as azimuth from 'azimuth-js';
5import { useNetwork } from 'store/network';
6import useLifecycle from './useLifecycle';
8// fetch the invites available for a point
9export default function useInvites(point) {
10 const { contracts } = useNetwork();
12 const [availableInvites, _setAvailableInvites] = useState(Maybe.Nothing());
14 const fetchInvites = useCallback(() => {
15 const _contracts = contracts.getOrElse(null);
22 const count = await azimuth.delegatedSending.getTotalUsableInvites(
26 _setAvailableInvites(Maybe.Just(count));
28 }, [_setAvailableInvites, point, contracts]);
30 // fetch invites on first render
31 useLifecycle(fetchInvites);
36 // TODO: look up sent/accepted
37 sentInvites: Maybe.Just(6),
38 acceptedInvites: Maybe.Just(5),
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list