refactor: clarify frontend module ownership
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate } from "react-router";
|
||||
|
||||
import { useAuth } from "@/features/auth";
|
||||
|
||||
function useSettingsPageVm() {
|
||||
const { t } = useTranslation();
|
||||
const { logout } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const onLogout = async () => {
|
||||
await logout();
|
||||
await navigate("/login", { replace: true });
|
||||
try {
|
||||
await logout();
|
||||
}
|
||||
catch {
|
||||
// The session is already cleared; the route guard owns navigation.
|
||||
}
|
||||
};
|
||||
|
||||
return { onLogout, t };
|
||||
|
||||
Reference in New Issue
Block a user