import { useNavigate } from 'react-router-dom'

import { getId } from '../utils/auth'

function useId() {
    const navigate = useNavigate()

    const id = getId()

    if (id < 0) {
        navigate('/login')
    }

    return id
}

export default useId
