refactor(lst): added side bar plus dummy menus
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
import {useRouter} from "@tanstack/react-router";
|
||||
import {useSessionStore} from "../store/sessionStore";
|
||||
import {useQueryClient} from "@tanstack/react-query";
|
||||
|
||||
export const useLogout = () => {
|
||||
const clearSession = useSessionStore((state) => state.clearSession);
|
||||
|
||||
const logout = () => {
|
||||
clearSession(); // Clears Zustand state
|
||||
return "Logged out";
|
||||
const {clearSession} = useSessionStore();
|
||||
const router = useRouter();
|
||||
const queryClient = useQueryClient();
|
||||
const logout = async () => {
|
||||
router.invalidate();
|
||||
router.clearCache();
|
||||
await clearSession();
|
||||
queryClient.invalidateQueries();
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
return logout;
|
||||
|
||||
Reference in New Issue
Block a user