import { setToken } from "@opengis/fastify-table/utils.js";

export default function token(params) {

    const { data, hash } = params;

    if (!data?.root?.user?.uid && !hash.uid) return '-';
    if (!hash || typeof hash !== 'object') return '-';

    // const id = hash?.edit ? hash?.id : data?.root?.id;
    // console.log(hash)
    const [token] = setToken({
        ids: [JSON.stringify(hash)],

        uid: data?.root?.user?.uid || hash.uid,
        array: 1,
    });
    return token;
}