
export const get = async function (request, response) {
    if (request.getAuthState() != 'authenticated') {
        response.set('HX-Redirect', '/login').status(401).end();
        return;
    }

    let dbUser = await request.getUser();

    response.render(`views/htmx/profile/showData.njk`, {
        user: {
            firstName: dbUser.givenname,
            lastName: dbUser.sn,
            mail: dbUser.mail,
        },
        data: {
            uidnumber: dbUser.uidnumber,
            username: dbUser.name,
            firstName: dbUser.givenname,
            lastName: dbUser.sn,
            mail: dbUser.mail,
        }
    });
}

export const post = async function (request, response) {
    console.log(request.body);
    response.redirect("/login");
}
