@bbki.ng/site 1.2.15 → 1.2.17
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
|
@@ -2,11 +2,16 @@ import { useTextPlainFile } from "@/hooks/use_text_plain_file";
|
|
|
2
2
|
import { useContext, useEffect } from "react";
|
|
3
3
|
import { usePost } from "@/hooks/use_post";
|
|
4
4
|
import { GlobalLoadingContext } from "@/global_loading_state_provider";
|
|
5
|
+
import { useAuthedFetcher } from "@/hooks/use_authed_fetcher";
|
|
6
|
+
import { preload, useSWRConfig } from "swr";
|
|
7
|
+
import { API } from "@/constants/routes";
|
|
5
8
|
|
|
6
9
|
export type fileReader = (f: File) => void;
|
|
7
10
|
export const useFile2Post = (): fileReader => {
|
|
8
11
|
const { content, title, reader } = useTextPlainFile();
|
|
9
12
|
|
|
13
|
+
const { mutate } = useSWRConfig();
|
|
14
|
+
|
|
10
15
|
const { setIsLoading } = useContext(GlobalLoadingContext);
|
|
11
16
|
|
|
12
17
|
const post = usePost();
|
|
@@ -20,7 +25,7 @@ export const useFile2Post = (): fileReader => {
|
|
|
20
25
|
|
|
21
26
|
post(title, content)
|
|
22
27
|
.then((r) => {
|
|
23
|
-
|
|
28
|
+
mutate(API.POSTS).then();
|
|
24
29
|
})
|
|
25
30
|
.finally(() => {
|
|
26
31
|
setIsLoading(false);
|
|
@@ -45,5 +45,9 @@ export default () => {
|
|
|
45
45
|
// scroll to top
|
|
46
46
|
window.scrollTo(0, 0);
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
<ArticlePage title={title}>
|
|
50
|
+
<div dangerouslySetInnerHTML={{ __html: posts.content }} />
|
|
51
|
+
</ArticlePage>
|
|
52
|
+
);
|
|
49
53
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ArticleList } from "./consts";
|
|
3
3
|
import { LinkProps, DropZone } from "@bbki.ng/components";
|
|
4
|
-
import { useRouteName } from "@/hooks";
|
|
5
4
|
import { usePosts } from "@/hooks/use_posts";
|
|
6
5
|
import { CenterLinkList } from "@/components";
|
|
7
6
|
import { useAuthed } from "@/hooks/use_authed";
|
|
@@ -13,7 +12,6 @@ type TxtProps = {
|
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
const Posts = (props: TxtProps) => {
|
|
16
|
-
const name = useRouteName();
|
|
17
15
|
const { titleList, isLoading, isError } = usePosts();
|
|
18
16
|
|
|
19
17
|
if (isLoading) {
|