Skip to content

Commit

Permalink
removed unused payload field from event
Browse files Browse the repository at this point in the history
  • Loading branch information
bobcaprice committed Apr 11, 2024
1 parent 33928ff commit 4d5295d
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ui/src/app/account/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class LoginComponent implements AfterViewInit, OnDestroy {
private ngZone: NgZone
) {
this.sub = this.eventService.on(EventType.LOG_IN_SUCCESS).subscribe((e) => {

Check warning on line 40 in ui/src/app/account/login/login.component.ts

View workflow job for this annotation

GitHub Actions / format

'e' is defined but never used
console.log(e.payload)
console.log('login success')
})
}

Expand Down Expand Up @@ -109,7 +109,7 @@ export class LoginComponent implements AfterViewInit, OnDestroy {
this.router.navigate([''])
})

this.eventService.broadcast(new Event(EventType.LOG_IN_SUCCESS, 'logged in'))
this.eventService.broadcast(new Event(EventType.LOG_IN_SUCCESS))

// previousState was set in the authExpiredInterceptor before being redirected to login modal.
// since login is successful, go to stored previousState and clear previousState
Expand Down
6 changes: 2 additions & 4 deletions ui/src/app/affiliation/affiliation-delete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ export class AffiliationDeleteDialogComponent implements OnInit {
if (id) {
this.affiliationService.delete(id).subscribe((response) => {
if (response) {
this.eventService.broadcast(new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Deleted an affiliation'))
this.eventService.broadcast(new Event(EventType.AFFILIATION_LIST_MODIFICATION))
this.alertService.broadcast(AlertType.AFFILIATION_DELETED)
} else {
this.eventService.broadcast(
new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Failed to delete an affiliation')
)
this.eventService.broadcast(new Event(EventType.AFFILIATION_LIST_MODIFICATION))
this.alertService.broadcast(AlertType.AFFILIATION_DELETE_FAILURE)
}
this.activeModal.dismiss(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class AffiliationImportDialogComponent {
}

close() {
this.eventService.broadcast(new Event(EventType.IMPORT_AFFILIATIONS, ''))
this.eventService.broadcast(new Event(EventType.IMPORT_AFFILIATIONS))
this.activeModal.dismiss(true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export class SendNotificationsDialogComponent implements OnInit {
close() {
this.eventService.broadcast({
type: EventType.SEND_NOTIFICATIONS,
payload: 'Send notifications',
})
this.activeModal.dismiss(true)
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/member/member-import-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class MemberImportDialogComponent {
this.csvErrors = JSON.parse(res)
this.loading = false
if (this.csvErrors.length === 0) {
this.eventService.broadcast(new Event(EventType.MEMBER_LIST_MODIFICATION, 'New member uploaded'))
this.eventService.broadcast(new Event(EventType.MEMBER_LIST_MODIFICATION))
this.activeModal.dismiss(true)
}
}
Expand Down
5 changes: 1 addition & 4 deletions ui/src/app/shared/model/event.model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { EventType } from 'src/app/app.constants'

export class Event {
constructor(
public type: EventType,
public payload: string
) {}
constructor(public type: EventType) {}
}
2 changes: 1 addition & 1 deletion ui/src/app/user/user-delete.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class UserDeleteDialogComponent implements OnInit {
confirmDelete(id: string | undefined) {
if (id) {
this.userService.delete(id).subscribe(() => {
this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED, 'Deleted a user'))
this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED))
this.activeModal.dismiss(true)
this.alertService.broadcast(AlertType.USER_DELETED)
})
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/user/user-import-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class UserImportDialogComponent {
this.csvErrors = JSON.parse(res)
this.loading = false
if (this.csvErrors.length === 0) {
this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED, 'New user settings uploaded'))
this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED))
this.activeModal.dismiss(true)
}
}
Expand Down

0 comments on commit 4d5295d

Please sign in to comment.