function def

This commit is contained in:
peintnermax
2024-08-08 15:47:18 +02:00
parent 25313db4a8
commit 58cde933c8
6 changed files with 30 additions and 11 deletions

View File

@@ -4,10 +4,12 @@ import { getMostRecentCookieWithLoginname } from "./cookies";
export async function loadMostRecentSession(
sessionService: any, // TODO: SessionServiceClient,
loginName?: string,
organization?: string,
sessionParams: { loginName?: string; organization?: string },
): Promise<Session | undefined> {
const recent = await getMostRecentCookieWithLoginname({ loginName, organization });
const recent = await getMostRecentCookieWithLoginname({
loginName: sessionParams.loginName,
organization: sessionParams.organization,
});
return sessionService
.getSession({ sessionId: recent.id, sessionToken: recent.token }, {})
.then((resp: GetSessionResponse) => resp.session);