diff --git a/Frontend/src/app/services/api.service.ts b/Frontend/src/app/services/api.service.ts index 215a0e9..5482ed0 100644 --- a/Frontend/src/app/services/api.service.ts +++ b/Frontend/src/app/services/api.service.ts @@ -450,6 +450,19 @@ export class ApiService { } } + /** + * Get all required information about the currently logged in user. If the user is not logged in or the + * session is not valid anymore, a 401 will come back from the backend. + * @return Observable The observable response of the api + */ + getUserInfo(): Observable { + try { + return this.http.post((this.apiUrl + '/users/checkSessionValid'), {}); + } catch (exception) { + process.stderr.write(`ERROR received from ${this.apiUrl}: ${exception}\n`); + } + } + /* ______ _ __ __ / ____/___ __ ______ _____(_) /____ _____/ /_ ____ ____ _____ / /_ / __ `/ | / / __ \/ ___/ / __/ _ \ / ___/ __ \/ __ \/ __ \/ ___/