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
|
||||||
|
|
|
||||||
|
|
@ -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,5 +1,5 @@
|
||||||
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") ||
|
||||||
|
|
@ -16,7 +16,7 @@ export const getPathname = (url?: string) => {
|
||||||
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