@bbki.ng/site 1.5.8 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/articles/now.mdx
CHANGED
|
@@ -10,6 +10,7 @@ import { useNavigate, useParams } from "react-router-dom";
|
|
|
10
10
|
import { useDelPost } from "@/hooks/use_delete_post";
|
|
11
11
|
import { toast } from "sonner";
|
|
12
12
|
import { confirm } from "@/utils";
|
|
13
|
+
import { useLoadingIndicator } from "@/hooks/useLoadingIndicator";
|
|
13
14
|
|
|
14
15
|
export const ArticleCtxMenu = (props: { children: ReactElement }) => {
|
|
15
16
|
const auth = useAuthed();
|
|
@@ -17,6 +18,7 @@ export const ArticleCtxMenu = (props: { children: ReactElement }) => {
|
|
|
17
18
|
const routeParams = useParams();
|
|
18
19
|
const nav = useNavigate();
|
|
19
20
|
const title = routeParams.title;
|
|
21
|
+
const dot = useLoadingIndicator();
|
|
20
22
|
|
|
21
23
|
if (!auth) {
|
|
22
24
|
return props.children;
|
|
@@ -27,11 +29,13 @@ export const ArticleCtxMenu = (props: { children: ReactElement }) => {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const doDel = useCallback(() => {
|
|
32
|
+
dot.setVisibility(true);
|
|
30
33
|
del(title)
|
|
31
34
|
.then(() => {
|
|
32
35
|
toast.success("删除成功", {
|
|
33
36
|
position: "top-center",
|
|
34
37
|
});
|
|
38
|
+
dot.setVisibility(false);
|
|
35
39
|
nav("/blog");
|
|
36
40
|
})
|
|
37
41
|
.catch(console.log);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GlobalLoadingContext } from "@/global_loading_state_provider";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
|
|
4
|
+
export const useLoadingIndicator = () => {
|
|
5
|
+
const globalCtx = useContext(GlobalLoadingContext);
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
setVisibility: globalCtx.setIsLoading,
|
|
9
|
+
isVisible: globalCtx.isLoading,
|
|
10
|
+
};
|
|
11
|
+
};
|