import { Component, Input } from '@angular/core'
-import { AuthService } from '@app/core'
-import { RestExtractor } from '@app/shared/rest'
-import { RedirectService } from '@app/core/routing/redirect.service'
-import { NotificationsService } from 'angular2-notifications'
+import { Notifier } from '@app/core'
+import { RedundancyService } from '@app/shared/shared-main'
import { I18n } from '@ngx-translate/i18n-polyfill'
-import { RedundancyService } from '@app/+admin/follows/shared/redundancy.service'
@Component({
selector: 'my-redundancy-checkbox',
@Input() host: string
constructor (
- private authService: AuthService,
- private restExtractor: RestExtractor,
- private redirectService: RedirectService,
- private notificationsService: NotificationsService,
+ private notifier: Notifier,
private redundancyService: RedundancyService,
private i18n: I18n
) { }
updateRedundancyState () {
this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
- .subscribe(
- () => {
- const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled')
+ .subscribe(
+ () => {
+ const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled')
- this.notificationsService.success(
- this.i18n('Success'),
- this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel })
- )
- },
+ this.notifier.success(this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel }))
+ },
- err => this.notificationsService.error(this.i18n('Error'), err.message)
- )
+ err => this.notifier.error(err.message)
+ )
}
}