import {createSessionClient} from "@/lib/backend/server-appwrite";
import {getUserSessions} from "@/lib/backend/api-sessions";

export default async function useSessionsList() {
    const {account} = await createSessionClient();
    const user = await account.get();

    if (!user) return; // consider throwing an exception here, because the user has to be logged in

    const userSessions = await getUserSessions(user!.$id)
    console.log("user, client or patient sessions", userSessions)
    return userSessions;
}