fix login logout redirect
This commit is contained in:
parent
b661ec752b
commit
f302ac6d74
|
|
@ -151,7 +151,13 @@ export const Form: FC<FMProps> = (props) => {
|
|||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
fm.status = "saving";
|
||||
fm.render();
|
||||
|
||||
fm.submit();
|
||||
|
||||
fm.status = "ready";
|
||||
fm.render();
|
||||
}}
|
||||
ref={(el) => {
|
||||
if (el) {
|
||||
|
|
@ -168,7 +174,6 @@ export const Form: FC<FMProps> = (props) => {
|
|||
className={cx(
|
||||
"form c-flex-1 c-w-full c-h-full c-relative c-overflow-auto"
|
||||
)}
|
||||
action="#"
|
||||
>
|
||||
{toaster_el && createPortal(<Toaster cn={cx} />, toaster_el)}
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ export { ButtonUpload } from "@/preset/profile/ButtonUpload";
|
|||
export { Profile } from "@/preset/profile/Profile";
|
||||
export { generateProfile } from "@/preset/profile/utils/generate";
|
||||
export { formatTime, longDate, shortDate, timeAgo } from "@/utils/date";
|
||||
export { getPathname } from "@/utils/pathname";
|
||||
export { getPathname, getBasename } from "@/utils/pathname";
|
||||
|
||||
export * from "@/comps/ui/input";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getPathname } from "lib/utils/pathname";
|
||||
import { getBasename, getPathname } from "lib/utils/pathname";
|
||||
import get from "lodash.get";
|
||||
|
||||
const w = window as any;
|
||||
|
|
@ -20,5 +20,6 @@ export const logout = (url_login?: string) => {
|
|||
if (localStorage.getItem("user" + id_site)) {
|
||||
localStorage.removeItem("user" + id_site);
|
||||
}
|
||||
if (url_login) navigate(url_login);
|
||||
if (url_login !== getPathname())
|
||||
location.href = `${getBasename()}${url_login}`;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
export const getPathname = (url?: string) => {
|
||||
// if (["localhost", "prasi.avolut.com"].includes(location.hostname)) {
|
||||
if (
|
||||
location.pathname.startsWith("/vi") ||
|
||||
location.pathname.startsWith("/prod") ||
|
||||
location.pathname.startsWith("/deploy")
|
||||
) {
|
||||
const hash = location.hash;
|
||||
if (url?.startsWith("/prod")) {
|
||||
return "/" + url.split("/").slice(3).join("/");
|
||||
}
|
||||
if (["prasi.avolut.com"].includes(location.hostname)) {
|
||||
if (
|
||||
location.pathname.startsWith("/vi") ||
|
||||
location.pathname.startsWith("/prod") ||
|
||||
location.pathname.startsWith("/deploy")
|
||||
) {
|
||||
const hash = location.hash;
|
||||
if (url?.startsWith("/prod")) {
|
||||
return "/" + url.split("/").slice(3).join("/");
|
||||
}
|
||||
|
||||
if (hash !== "") {
|
||||
return "/" + location.pathname.split("/").slice(3).join("/") + hash;
|
||||
} else {
|
||||
return "/" + location.pathname.split("/").slice(3).join("/");
|
||||
if (hash !== "") {
|
||||
return "/" + location.pathname.split("/").slice(3).join("/") + hash;
|
||||
} else {
|
||||
return "/" + location.pathname.split("/").slice(3).join("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
return location.pathname;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue