2024-12-10 18:56:50 +01:00
|
|
|
import { useAppDispatch, useAppSelector } from "./useStore"
|
2024-12-11 17:26:36 +01:00
|
|
|
import { AuthPayload, login, logout } from "@/utils/features/auth/authSlice"
|
2024-12-10 18:56:50 +01:00
|
|
|
|
|
|
|
export const useAuth = () => useAppSelector((state) => state.auth)
|
|
|
|
export const useAuthLogin = () => {
|
|
|
|
const dispath = useAppDispatch()
|
|
|
|
return (payload: AuthPayload) => dispath(login(payload))
|
|
|
|
}
|
|
|
|
export const useAuthLogout = () => {
|
|
|
|
const dispatch = useAppDispatch()
|
|
|
|
return () => dispatch(logout())
|
|
|
|
}
|