]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+my-account/my-account-applications/my-account-applications.component.ts
Update translations
[github/Chocobozzz/PeerTube.git] / client / src / app / +my-account / my-account-applications / my-account-applications.component.ts
index 233e42c838c5b6b3367d7b5fe292e238b944503b..e88cdd228697e3df9d9e02fbbd0f6b841cbfce01 100644 (file)
@@ -1,6 +1,5 @@
-
 import { Component, OnInit } from '@angular/core'
-import { AuthService, Notifier, ConfirmService, ScopedTokensService } from '@app/core'
+import { AuthService, ConfirmService, Notifier, ScopedTokensService } from '@app/core'
 import { VideoService } from '@app/shared/shared-main'
 import { FeedFormat } from '@shared/models'
 import { ScopedToken } from '@shared/models/users/user-scoped-token'
@@ -15,7 +14,7 @@ export class MyAccountApplicationsComponent implements OnInit {
   feedUrl: string
   feedToken: string
 
-  private baseURL = environment.originServerUrl
+  private baseURL = environment.originServerUrl || window.location.origin
 
   constructor (
     private authService: AuthService,
@@ -28,33 +27,30 @@ export class MyAccountApplicationsComponent implements OnInit {
   ngOnInit () {
     this.feedUrl = this.baseURL
     this.scopedTokensService.getScopedTokens()
-      .subscribe(
-        tokens => this.regenApplications(tokens),
+      .subscribe({
+        next: tokens => this.regenApplications(tokens),
 
-        err => {
-          this.notifier.error(err.message)
-        }
-      )
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   async renewToken () {
     const res = await this.confirmService.confirm(
+      // eslint-disable-next-line max-len
       $localize`Renewing the token will disallow previously configured clients from retrieving the feed until they use the new token. Proceed?`,
       $localize`Renew token`
     )
     if (res === false) return
 
-    this.scopedTokensService.renewScopedTokens().subscribe(
-      tokens => {
-        this.regenApplications(tokens)
-        this.notifier.success($localize`Token renewed. Update your client configuration accordingly.`)
-      },
-
-      err => {
-        this.notifier.error(err.message)
-      }
-    )
+    this.scopedTokensService.renewScopedTokens()
+      .subscribe({
+        next: tokens => {
+          this.regenApplications(tokens)
+          this.notifier.success($localize`Token renewed. Update your client configuration accordingly.`)
+        },
 
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private regenApplications (tokens: ScopedToken) {