mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix useClickForm
This commit is contained in:
+11
-13
@@ -9,20 +9,18 @@ const useClickForm = () => {
|
|||||||
const handleClickForm = () => {
|
const handleClickForm = () => {
|
||||||
setShowPostForm(true);
|
setShowPostForm(true);
|
||||||
setShowPostFormLink(false);
|
setShowPostFormLink(false);
|
||||||
|
const pathComponents = location.pathname.split("/");
|
||||||
|
const subplebbitAddress = pathComponents[2];
|
||||||
|
const threadCid = pathComponents[4];
|
||||||
|
|
||||||
const subplebbitAddress = location.pathname.split("/")[1];
|
if (pathComponents[1] === "p") {
|
||||||
const threadCid = location.pathname.split("/")[3];
|
if (pathComponents[3] === "c") {
|
||||||
|
navigate(`/p/${subplebbitAddress}/c/${threadCid}/post`);
|
||||||
if (location.pathname === "/") {
|
} else if (pathComponents[3] === "catalog") {
|
||||||
navigate("/post");
|
navigate(`/p/${subplebbitAddress}/catalog/post`);
|
||||||
} else if (location.pathname.endsWith("/catalog")) {
|
} else {
|
||||||
navigate(`/p/${subplebbitAddress}/catalog/post`);
|
navigate(`/p/${subplebbitAddress}/post`);
|
||||||
} else if (location.pathname.endsWith("/thread")) {
|
}
|
||||||
navigate(`/p/${subplebbitAddress}/c/post`);
|
|
||||||
} else if (threadCid) {
|
|
||||||
navigate(`/p/${subplebbitAddress}/c/${threadCid}/post`);
|
|
||||||
} else {
|
|
||||||
navigate(`/p/${subplebbitAddress}/post`);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user