15 lines
497 B
TypeScript
15 lines
497 B
TypeScript
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
|
import { Benutzer } from "#lib/client/prisma.js";
|
|
import { api } from "astro-typesafe-api/client";
|
|
import Cookies from "js-cookie";
|
|
|
|
export async function benutzerLesen(benutzerId: string): Promise<Benutzer> {
|
|
const benutzer = await api.user.GET.fetch({ id: benutzerId }
|
|
, {
|
|
headers: {
|
|
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
|
}
|
|
});
|
|
|
|
return benutzer[0];
|
|
} |