Add logout method
parent
2b1ab96da5
commit
f888b96c7a
13
src/index.ts
13
src/index.ts
|
@ -127,6 +127,19 @@ export async function login(
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the currently open session.
|
||||
*
|
||||
* You **must** be logged in to the portal before calling this method.
|
||||
*/
|
||||
export async function logout(): Promise<void> {
|
||||
// Check if the user is logged
|
||||
if (!shared.isLogged) throw new UserNotLogged(USER_NOT_LOGGED);
|
||||
|
||||
await shared.session.delete();
|
||||
shared.setIsLogged(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chek if exists a new version of the handiwork.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue