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) => {
|
onSubmit={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
fm.status = "saving";
|
||||||
|
fm.render();
|
||||||
|
|
||||||
fm.submit();
|
fm.submit();
|
||||||
|
|
||||||
|
fm.status = "ready";
|
||||||
|
fm.render();
|
||||||
}}
|
}}
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|
@ -168,7 +174,6 @@ export const Form: FC<FMProps> = (props) => {
|
||||||
className={cx(
|
className={cx(
|
||||||
"form c-flex-1 c-w-full c-h-full c-relative c-overflow-auto"
|
"form c-flex-1 c-w-full c-h-full c-relative c-overflow-auto"
|
||||||
)}
|
)}
|
||||||
action="#"
|
|
||||||
>
|
>
|
||||||
{toaster_el && createPortal(<Toaster cn={cx} />, toaster_el)}
|
{toaster_el && createPortal(<Toaster cn={cx} />, toaster_el)}
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ export { ShowHidePanel } from "@/comps/custom/ShowHidePanel";
|
||||||
export { PanelBody } from "@/comps/tab/parts/PanelBody";
|
export { PanelBody } from "@/comps/tab/parts/PanelBody";
|
||||||
export { PanelHeader } from "@/comps/tab/parts/PanelHead";
|
export { PanelHeader } from "@/comps/tab/parts/PanelHead";
|
||||||
export { PanelTab } from "@/comps/tab/Tab";
|
export { PanelTab } from "@/comps/tab/Tab";
|
||||||
|
|
||||||
/*Popup*/
|
/*Popup*/
|
||||||
export { Popup } from "@/comps/popup/PopUp";
|
export { Popup } from "@/comps/popup/PopUp";
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ export { ButtonUpload } from "@/preset/profile/ButtonUpload";
|
||||||
export { Profile } from "@/preset/profile/Profile";
|
export { Profile } from "@/preset/profile/Profile";
|
||||||
export { generateProfile } from "@/preset/profile/utils/generate";
|
export { generateProfile } from "@/preset/profile/utils/generate";
|
||||||
export { formatTime, longDate, shortDate, timeAgo } from "@/utils/date";
|
export { formatTime, longDate, shortDate, timeAgo } from "@/utils/date";
|
||||||
export { getPathname } from "@/utils/pathname";
|
export { getPathname, getBasename } from "@/utils/pathname";
|
||||||
|
|
||||||
export * from "@/comps/ui/input";
|
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";
|
import get from "lodash.get";
|
||||||
|
|
||||||
const w = window as any;
|
const w = window as any;
|
||||||
|
|
@ -20,5 +20,6 @@ export const logout = (url_login?: string) => {
|
||||||
if (localStorage.getItem("user" + id_site)) {
|
if (localStorage.getItem("user" + id_site)) {
|
||||||
localStorage.removeItem("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) => {
|
export const getPathname = (url?: string) => {
|
||||||
// if (["localhost", "prasi.avolut.com"].includes(location.hostname)) {
|
if (["prasi.avolut.com"].includes(location.hostname)) {
|
||||||
if (
|
if (
|
||||||
location.pathname.startsWith("/vi") ||
|
location.pathname.startsWith("/vi") ||
|
||||||
location.pathname.startsWith("/prod") ||
|
location.pathname.startsWith("/prod") ||
|
||||||
location.pathname.startsWith("/deploy")
|
location.pathname.startsWith("/deploy")
|
||||||
) {
|
) {
|
||||||
const hash = location.hash;
|
const hash = location.hash;
|
||||||
if (url?.startsWith("/prod")) {
|
if (url?.startsWith("/prod")) {
|
||||||
return "/" + url.split("/").slice(3).join("/");
|
return "/" + url.split("/").slice(3).join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hash !== "") {
|
if (hash !== "") {
|
||||||
return "/" + location.pathname.split("/").slice(3).join("/") + hash;
|
return "/" + location.pathname.split("/").slice(3).join("/") + hash;
|
||||||
} else {
|
} else {
|
||||||
return "/" + location.pathname.split("/").slice(3).join("/");
|
return "/" + location.pathname.split("/").slice(3).join("/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
return location.pathname;
|
return location.pathname;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue