mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
refactor(frontend): remove unnecessary state in useApi hooks
This commit is contained in:
parent
ca4e10e473
commit
42737e570d
1 changed files with 2 additions and 6 deletions
|
|
@ -31,8 +31,6 @@ export const useRecentListens = (options: PaginationOptions) => {
|
|||
export const useListensReport = (options: ListenReportOptions) => {
|
||||
const { client } = useApiClient();
|
||||
|
||||
const [initialData] = useState(INITIAL_EMPTY_ARRAY);
|
||||
|
||||
const fetchData = useMemo(() => () => getListensReport(options, client), [
|
||||
options,
|
||||
client,
|
||||
|
|
@ -40,7 +38,7 @@ export const useListensReport = (options: ListenReportOptions) => {
|
|||
|
||||
const { value: report, pending: isLoading, error } = useAsync(
|
||||
fetchData,
|
||||
initialData
|
||||
INITIAL_EMPTY_ARRAY
|
||||
);
|
||||
|
||||
return { report, isLoading, error };
|
||||
|
|
@ -49,8 +47,6 @@ export const useListensReport = (options: ListenReportOptions) => {
|
|||
export const useTopArtists = (options: TopArtistsOptions) => {
|
||||
const { client } = useApiClient();
|
||||
|
||||
const [initialData] = useState(INITIAL_EMPTY_ARRAY);
|
||||
|
||||
const fetchData = useMemo(() => () => getTopArtists(options, client), [
|
||||
options,
|
||||
client,
|
||||
|
|
@ -58,7 +54,7 @@ export const useTopArtists = (options: TopArtistsOptions) => {
|
|||
|
||||
const { value: topArtists, pending: isLoading, error } = useAsync(
|
||||
fetchData,
|
||||
initialData
|
||||
INITIAL_EMPTY_ARRAY
|
||||
);
|
||||
|
||||
return { topArtists, isLoading, error };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue