From c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 10:42:24 +0200 Subject: Refactor requests --- .../+about/about-instance/contact-admin-modal.component.ts | 3 +-- client/src/app/+accounts/accounts.component.ts | 3 +-- .../+my-video-channels/my-video-channel-create.component.ts | 7 +++---- client/src/app/+page-not-found/page-not-found.component.ts | 3 ++- client/src/app/+video-channels/video-channels.component.ts | 2 +- .../video-add-components/video-upload.component.ts | 3 +-- client/src/app/+videos/+video-watch/video-watch.component.ts | 11 +++++++++-- client/src/app/core/auth/auth.service.ts | 3 +-- client/src/app/core/rest/rest-extractor.service.ts | 3 +-- client/src/app/helpers/utils.ts | 2 +- .../app/shared/shared-main/auth/auth-interceptor.service.ts | 8 ++++---- client/src/standalone/videos/embed.ts | 2 +- 12 files changed, 26 insertions(+), 24 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+about/about-instance/contact-admin-modal.component.ts b/client/src/app/+about/about-instance/contact-admin-modal.component.ts index a528faa20..37e9feacb 100644 --- a/client/src/app/+about/about-instance/contact-admin-modal.component.ts +++ b/client/src/app/+about/about-instance/contact-admin-modal.component.ts @@ -11,8 +11,7 @@ import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' import { InstanceService } from '@app/shared/shared-instance' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' -import { HTMLServerConfig } from '@shared/models' +import { HTMLServerConfig, HttpStatusCode } from '@shared/models' type Prefill = { subject?: string diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index c69b04a01..5b59f3cd0 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts @@ -13,8 +13,7 @@ import { VideoService } from '@app/shared/shared-main' import { AccountReportComponent } from '@app/shared/shared-moderation' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' -import { User, UserRight } from '@shared/models' +import { HttpStatusCode, User, UserRight } from '@shared/models' import { AccountSearchComponent } from './account-search/account-search.component' @Component({ diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts index b3265210f..433475f66 100644 --- a/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts +++ b/client/src/app/+my-library/+my-video-channels/my-video-channel-create.component.ts @@ -1,3 +1,5 @@ +import { of } from 'rxjs' +import { switchMap } from 'rxjs/operators' import { Component, OnInit } from '@angular/core' import { Router } from '@angular/router' import { AuthService, Notifier } from '@app/core' @@ -9,11 +11,8 @@ import { } from '@app/shared/form-validators/video-channel-validators' import { FormValidatorService } from '@app/shared/shared-forms' import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' -import { VideoChannelCreate } from '@shared/models' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode, VideoChannelCreate } from '@shared/models' import { MyVideoChannelEdit } from './my-video-channel-edit' -import { switchMap } from 'rxjs/operators' -import { of } from 'rxjs' @Component({ templateUrl: './my-video-channel-edit.component.html', diff --git a/client/src/app/+page-not-found/page-not-found.component.ts b/client/src/app/+page-not-found/page-not-found.component.ts index 639e5db78..10645a634 100644 --- a/client/src/app/+page-not-found/page-not-found.component.ts +++ b/client/src/app/+page-not-found/page-not-found.component.ts @@ -1,7 +1,8 @@ import { Component, OnInit } from '@angular/core' import { Title } from '@angular/platform-browser' import { Router } from '@angular/router' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '@shared/models' + @Component({ selector: 'my-page-not-found', templateUrl: './page-not-found.component.html', diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts index 3833d9c54..6479644f1 100644 --- a/client/src/app/+video-channels/video-channels.component.ts +++ b/client/src/app/+video-channels/video-channels.component.ts @@ -7,7 +7,7 @@ import { AuthService, MarkdownService, Notifier, RestExtractor, ScreenService } import { ListOverflowItem, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' import { SupportModalComponent } from '@app/shared/shared-support-modal' import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '@shared/models' @Component({ templateUrl: './video-channels.component.html', diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index 627de33c0..e9420fe62 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts @@ -7,8 +7,7 @@ import { genericUploadErrorHandler, scrollToTop } from '@app/helpers' import { FormValidatorService } from '@app/shared/shared-forms' import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' import { LoadingBarService } from '@ngx-loading-bar/core' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' -import { VideoPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { UploaderXFormData } from './uploaderx-form-data' import { VideoSend } from './video-send' diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index d078844c3..7460ae3fc 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -21,8 +21,15 @@ import { isXPercentInViewport, scrollToTop } from '@app/helpers' import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main' import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' -import { HTMLServerConfig, PeerTubeProblemDocument, ServerErrorCode, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' +import { + HTMLServerConfig, + HttpStatusCode, + PeerTubeProblemDocument, + ServerErrorCode, + VideoCaption, + VideoPrivacy, + VideoState +} from '@shared/models' import { cleanupVideoWatch, getStoredTheater, getStoredVideoWatchHistory } from '../../../assets/player/peertube-player-local-storage' import { CustomizationOptions, diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index cdf13186b..60bd72c60 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -6,12 +6,11 @@ import { Injectable } from '@angular/core' import { Router } from '@angular/router' import { Notifier } from '@app/core/notification/notifier.service' import { objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index' -import { MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' +import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' import { environment } from '../../../environments/environment' import { RestExtractor } from '../rest/rest-extractor.service' import { AuthStatus } from './auth-status.model' import { AuthUser } from './auth-user.model' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' interface UserLoginWithUsername extends UserLogin { access_token: string diff --git a/client/src/app/core/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.ts index 08ab49512..2a926e68f 100644 --- a/client/src/app/core/rest/rest-extractor.service.ts +++ b/client/src/app/core/rest/rest-extractor.service.ts @@ -2,8 +2,7 @@ import { throwError as observableThrowError } from 'rxjs' import { Injectable } from '@angular/core' import { Router } from '@angular/router' import { dateToHuman } from '@app/helpers' -import { ResultList } from '@shared/models' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode, ResultList } from '@shared/models' @Injectable() export class RestExtractor { diff --git a/client/src/app/helpers/utils.ts b/client/src/app/helpers/utils.ts index 94f6def26..edcaf50e0 100644 --- a/client/src/app/helpers/utils.ts +++ b/client/src/app/helpers/utils.ts @@ -3,7 +3,7 @@ import { SelectChannelItem } from 'src/types/select-options-item.model' import { DatePipe } from '@angular/common' import { HttpErrorResponse } from '@angular/common/http' import { Notifier } from '@app/core' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '@shared/models' import { environment } from '../../environments/environment' import { AuthService } from '../core/auth' diff --git a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts index 5bcad36d0..a75c8a25c 100644 --- a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts +++ b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts @@ -1,11 +1,11 @@ import { Observable, of, throwError as observableThrowError } from 'rxjs' import { catchError, switchMap } from 'rxjs/operators' -import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpErrorResponse } from '@angular/common/http' +import { HTTP_INTERCEPTORS, HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http' import { Injectable, Injector } from '@angular/core' -import { AuthService } from '@app/core/auth/auth.service' import { Router } from '@angular/router' -import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' -import { OAuth2ErrorCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models/server' +import { AuthService } from '@app/core/auth/auth.service' +import { HttpStatusCode } from '@shared/models' +import { OAuth2ErrorCode, PeerTubeProblemDocument } from '@shared/models/server' @Injectable() export class AuthInterceptor implements HttpInterceptor { diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index e59d8b940..97437ce45 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts @@ -1,9 +1,9 @@ import './embed.scss' import videojs from 'video.js' import { peertubeTranslate } from '../../../../shared/core-utils/i18n' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HTMLServerConfig, + HttpStatusCode, OAuth2ErrorCode, ResultList, UserRefreshToken, -- cgit v1.2.3