2024-12-10 17:56:50 +00:00
|
|
|
import { useAppDispatch, useAppSelector } from "./useStore"
|
2024-12-11 16:26:36 +00:00
|
|
|
import { AuthPayload, login, logout } from "@/utils/features/auth/authSlice"
|
2024-12-10 17:56:50 +00: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())
|
|
|
|
}
|