MCPcopy
hub / github.com/yourselfhosted/slash / useLoading

Function useLoading

frontend/web/src/hooks/useLoading.ts:3–33  ·  view source on GitHub ↗
(initialState = true)

Source from the content-addressed store, hash-verified

1import { useState } from "react";
2
3const useLoading = (initialState = true) => {
4 const [state, setState] = useState({ isLoading: initialState, isFailed: false, isSucceed: false });
5
6 return {
7 ...state,
8 setLoading: () => {
9 setState({
10 ...state,
11 isLoading: true,
12 isFailed: false,
13 isSucceed: false,
14 });
15 },
16 setFinish: () => {
17 setState({
18 ...state,
19 isLoading: false,
20 isFailed: false,
21 isSucceed: true,
22 });
23 },
24 setError: () => {
25 setState({
26 ...state,
27 isLoading: false,
28 isFailed: true,
29 isSucceed: false,
30 });
31 },
32 };
33};
34
35export default useLoading;

Callers 12

EditUserinfoDialogFunction · 0.85
ChangePasswordDialogFunction · 0.85
CreateUserDialogFunction · 0.85
CreateShortcutDrawerFunction · 0.85
CreateCollectionDrawerFunction · 0.85
CreateAccessTokenDialogFunction · 0.85
SignUpFunction · 0.85
ShortcutDetailFunction · 0.85
MemoDashboardFunction · 0.85
HomeFunction · 0.85
CollectionDashboardFunction · 0.85
SignInFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…