Skip to content

Commit

Permalink
fix noty api
Browse files Browse the repository at this point in the history
  • Loading branch information
gallayl committed Mar 17, 2024
1 parent d704cad commit 3d077a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/services/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export class SessionService implements IdentityContext {
const { result: usr } = await this.api.call({ method: 'POST', action: '/login', body: { username, password } })
this.currentUser.setValue(usr)
this.state.setValue('authenticated')
this.notys.addNoty({
this.notys.emit('onNotyAdded', {
body: 'Welcome back ;)',
title: 'You have been logged in',
type: 'success',
})
} catch (error) {
this.loginError.setValue(error instanceof Error ? error.message : '')
this.notys.addNoty({
this.notys.emit('onNotyAdded', {
body: 'Please check your credentials',
title: 'Login failed',
type: 'warning',
Expand All @@ -68,7 +68,7 @@ export class SessionService implements IdentityContext {
this.api.call({ method: 'POST', action: '/logout' })
this.currentUser.setValue(null)
this.state.setValue('unauthenticated')
this.notys.addNoty({
this.notys.emit('onNotyAdded', {
body: 'Come back soon...',
title: 'You have been logged out',
type: 'info',
Expand All @@ -91,7 +91,7 @@ export class SessionService implements IdentityContext {
public async getCurrentUser<TUser extends User>(): Promise<TUser> {
const currentUser = this.currentUser.getValue()
if (!currentUser) {
this.notys.addNoty({
this.notys.emit('onNotyAdded', {
body: ':(((',
title: 'No User available',
type: 'warning',
Expand Down

0 comments on commit 3d077a5

Please sign in to comment.