import { useAuthFetch } from "../../authorization"

interface LoginToken {
    id: string
    ip: string
    end: string
    user_agent: UserAgent
    created_at: string
    last_login: string
}

interface UserAgent {
    name: string
    version: string
    os: string
    os_version: string
    mobile: boolean
    tablet: boolean
    desktop: boolean
}

export function LoginTokensMini() {
    const tokens = useAuthFetch<LoginToken[]>("/login/tokens", "GET")
    return tokens && (
        <div>
            <span>
                {tokens.length} Login Token{tokens.length === 1 ? "" : "s"}
            </span>
        </div>
    )
}