mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
(feat:settings) smoother transitions
This commit is contained in:
@@ -18,6 +18,16 @@ export default function Logs() {
|
||||
const [loadingChatbots, setLoadingChatbots] = useState(true);
|
||||
const [loadingLogs, setLoadingLogs] = useState(true);
|
||||
|
||||
const setLoadingLogsWithMinDuration = useCallback((isLoading: boolean) => {
|
||||
if (isLoading) {
|
||||
setLoadingLogs(true);
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
setLoadingLogs(false);
|
||||
}, 2000);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const fetchChatbots = async () => {
|
||||
setLoadingChatbots(true);
|
||||
try {
|
||||
@@ -35,7 +45,7 @@ export default function Logs() {
|
||||
};
|
||||
|
||||
const fetchLogs = async () => {
|
||||
setLoadingLogs(true);
|
||||
setLoadingLogsWithMinDuration(true);
|
||||
try {
|
||||
const response = await userService.getLogs({
|
||||
page: page,
|
||||
@@ -51,7 +61,7 @@ export default function Logs() {
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoadingLogs(false);
|
||||
setLoadingLogsWithMinDuration(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user