frontend
Preparing search index...
hooks/useGameApi
useGameApi
Function useGameApi
useGameApi
<
TState
,
TArgs
extends
unknown
[]
>
(
apiFn
:
(
...
args
:
TArgs
)
=>
Promise
<
TState
>
,
options
?:
{
onSuccess
?:
(
res
:
TState
)
=>
void
|
Promise
<
void
>
}
,
)
:
{
error
:
string
|
null
;
exec
:
(
...
args
:
TArgs
)
=>
Promise
<
void
>
;
loading
:
boolean
;
retry
:
()
=>
Promise
<
void
>
;
setState
:
Dispatch
<
SetStateAction
<
TState
|
null
>
>
;
state
:
TState
|
null
;
}
Hook that wraps a game API function with loading, error, and state management.
Type Parameters
TState
TArgs
extends
unknown
[]
Parameters
apiFn
:
(
...
args
:
TArgs
)
=>
Promise
<
TState
>
Optional
options
:
{
onSuccess
?:
(
res
:
TState
)
=>
void
|
Promise
<
void
>
}
Returns
{
error
:
string
|
null
;
exec
:
(
...
args
:
TArgs
)
=>
Promise
<
void
>
;
loading
:
boolean
;
retry
:
()
=>
Promise
<
void
>
;
setState
:
Dispatch
<
SetStateAction
<
TState
|
null
>
>
;
state
:
TState
|
null
;
}
Settings
Member Visibility
Protected
Inherited
External
Theme
OS
Light
Dark
frontend
Loading...
Hook that wraps a game API function with loading, error, and state management.