13 lines
454 B
TypeScript
13 lines
454 B
TypeScript
import { useAppDispatch, useAppSelector } from "./useStore"
|
|
import { AuthPayload, login, logout } from "@/utils/features/location/authSlice"
|
|
|
|
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())
|
|
}
|