Add logout method

pull/77/head
MillenniumEarl 2021-03-10 12:25:43 +01:00
parent 2b1ab96da5
commit f888b96c7a
1 changed files with 13 additions and 0 deletions

View File

@ -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.
*