refactor: streamline data fetching in various hooks and components
Deploy to VPS / deploy (push) Successful in 2m39s
Deploy to VPS / deploy (push) Successful in 2m39s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import { dashboardApi } from "@/lib/api";
|
||||
import type {
|
||||
@@ -36,6 +36,10 @@ export function useStats(): UseStatsReturn {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetch();
|
||||
}, [fetch]);
|
||||
|
||||
return { stats, loading, error, refetch: fetch };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user