@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
16 lines (13 loc) • 595 B
text/typescript
import { Archon } from "../Archon.js";
import { Session, SessionId } from "../types/user.js";
/**
* End the session of the user. You should redirect the user away from protected resources after calling this function.
* @param session The session to end.
*/
export default async function endSession(session: Session | SessionId): Promise<void> {
const request = await Archon.request(`/users/session/${typeof session === "number" ? session : session.id}`, "DELETE");
if (request.status !== 200) {
throw new Error(`Failed to end session: ${request.data}`);
}
return;
}