import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useData, useInput } from "../../data/index.js";
import { getUser } from "../../../../authentication/index.js";
import { listUserCredentials } from "../../../../data/index.js";
export const path = "/user-credentials";
export async function handler() {
    return {
        userCredentials: await listUserCredentials((await getUser()).userId)
    };
}
const LINK_CLASS = "text-blue-600 hover:bg-white underline hover:underline-offset-2";
export function ListCredentials() {
    const { userCredentials } = useInput();
    const { isUnauthenticated, url } = useData();
    const { pathname } = new URL(url);
    return (_jsx("div", { className: "flex flex-col", children: _jsx("div", { className: "flex flex-col divide-y", children: userCredentials.map(userCredential => (_jsxs("div", { className: "flex flex-row justify-between", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx("span", { children: userCredential.authenticatorType }), _jsx("span", { className: "text-sm text-gray-700", children: userCredential.credentialId })] }), _jsx("div", { children: _jsx("a", { href: `/api/version/1/users/${userCredential.userId}/credentials/${userCredential.userCredentialId}/delete?redirect=${pathname}`, className: LINK_CLASS, children: "Delete" }) })] }, userCredential.userCredentialId))) }) }));
}
export const Component = ListCredentials;
//# sourceMappingURL=list.js.map