@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
13 lines (12 loc) • 502 B
JavaScript
import { Archon } from "../Archon.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) {
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;
}