Remove unnecessary function

pull/4736/head
Chocobozzz 2022-01-18 11:37:29 +01:00
parent c1f7a737cf
commit e8bffe9690
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
15 changed files with 44 additions and 174 deletions

View File

@ -9,10 +9,6 @@ export class RestExtractor {
constructor (private router: Router) { } constructor (private router: Router) { }
extractDataBool () {
return true
}
applyToResultListData <T, A, U> ( applyToResultListData <T, A, U> (
result: ResultList<T>, result: ResultList<T>,
fun: (data: T, ...args: A[]) => U, fun: (data: T, ...args: A[]) => U,

View File

@ -49,10 +49,7 @@ export class UserService {
} }
return this.authHttp.put(url, body) return this.authHttp.put(url, body)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
changeEmail (password: string, newEmail: string) { changeEmail (password: string, newEmail: string) {
@ -63,10 +60,7 @@ export class UserService {
} }
return this.authHttp.put(url, body) return this.authHttp.put(url, body)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -90,20 +84,14 @@ export class UserService {
const url = UserService.BASE_USERS_URL + 'me' const url = UserService.BASE_USERS_URL + 'me'
return this.authHttp.put(url, profile) return this.authHttp.put(url, profile)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
deleteMe () { deleteMe () {
const url = UserService.BASE_USERS_URL + 'me' const url = UserService.BASE_USERS_URL + 'me'
return this.authHttp.delete(url) return this.authHttp.delete(url)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
changeAvatar (avatarForm: FormData) { changeAvatar (avatarForm: FormData) {
@ -117,16 +105,12 @@ export class UserService {
const url = UserService.BASE_USERS_URL + 'me/avatar' const url = UserService.BASE_USERS_URL + 'me/avatar'
return this.authHttp.delete(url) return this.authHttp.delete(url)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
signup (userCreate: UserRegister) { signup (userCreate: UserRegister) {
return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => this.signupInThisSession = true), tap(() => this.signupInThisSession = true),
catchError(err => this.restExtractor.handleError(err)) catchError(err => this.restExtractor.handleError(err))
) )
@ -143,10 +127,7 @@ export class UserService {
const url = UserService.BASE_USERS_URL + '/ask-reset-password' const url = UserService.BASE_USERS_URL + '/ask-reset-password'
return this.authHttp.post(url, { email }) return this.authHttp.post(url, { email })
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
resetPassword (userId: number, verificationString: string, password: string) { resetPassword (userId: number, verificationString: string, password: string) {
@ -157,10 +138,7 @@ export class UserService {
} }
return this.authHttp.post(url, body) return this.authHttp.post(url, body)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
verifyEmail (userId: number, verificationString: string, isPendingEmail: boolean) { verifyEmail (userId: number, verificationString: string, isPendingEmail: boolean) {
@ -171,20 +149,14 @@ export class UserService {
} }
return this.authHttp.post(url, body) return this.authHttp.post(url, body)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
askSendVerifyEmail (email: string) { askSendVerifyEmail (email: string) {
const url = UserService.BASE_USERS_URL + '/ask-send-verify-email' const url = UserService.BASE_USERS_URL + '/ask-send-verify-email'
return this.authHttp.post(url, { email }) return this.authHttp.post(url, { email })
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
autocomplete (search: string): Observable<string[]> { autocomplete (search: string): Observable<string[]> {
@ -216,18 +188,12 @@ export class UserService {
addUser (userCreate: UserCreate) { addUser (userCreate: UserCreate) {
return this.authHttp.post(UserService.BASE_USERS_URL, userCreate) return this.authHttp.post(UserService.BASE_USERS_URL, userCreate)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
updateUser (userId: number, userUpdate: UserUpdate) { updateUser (userId: number, userUpdate: UserUpdate) {
return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate) return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
updateUsers (users: UserServerModel[], userUpdate: UserUpdate) { updateUsers (users: UserServerModel[], userUpdate: UserUpdate) {

View File

@ -71,49 +71,34 @@ export class InstanceFollowService {
} }
return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body) return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
unfollow (follow: ActorFollow) { unfollow (follow: ActorFollow) {
const handle = follow.following.name + '@' + follow.following.host const handle = follow.following.name + '@' + follow.following.host
return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + handle) return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + handle)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
acceptFollower (follow: ActorFollow) { acceptFollower (follow: ActorFollow) {
const handle = follow.follower.name + '@' + follow.follower.host const handle = follow.follower.name + '@' + follow.follower.host
return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/accept`, {}) return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/accept`, {})
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
rejectFollower (follow: ActorFollow) { rejectFollower (follow: ActorFollow) {
const handle = follow.follower.name + '@' + follow.follower.host const handle = follow.follower.name + '@' + follow.follower.host
return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/reject`, {}) return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/reject`, {})
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
removeFollower (follow: ActorFollow) { removeFollower (follow: ActorFollow) {
const handle = follow.follower.name + '@' + follow.follower.host const handle = follow.follower.name + '@' + follow.follower.host
return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`) return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
} }

View File

@ -1,5 +1,5 @@
import { of } from 'rxjs' import { of } from 'rxjs'
import { catchError, map } from 'rxjs/operators' import { catchError } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { RestExtractor } from '@app/core' import { RestExtractor } from '@app/core'
@ -30,9 +30,6 @@ export class CustomPageService {
updateInstanceHomepage (content: string) { updateInstanceHomepage (content: string) {
return this.authHttp.put(CustomPageService.BASE_INSTANCE_HOMEPAGE_URL, { content }) return this.authHttp.put(CustomPageService.BASE_INSTANCE_HOMEPAGE_URL, { content })
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
} }

View File

@ -1,4 +1,4 @@
import { catchError, map, switchMap } from 'rxjs/operators' import { catchError, switchMap } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http' import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'
@ -43,9 +43,6 @@ export class UserHistoryService {
clearAll () { clearAll () {
return this.authHttp return this.authHttp
.post(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/remove', {}) .post(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/remove', {})
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(() => this.restExtractor.extractDataBool()),
catchError(err => this.restExtractor.handleError(err))
)
} }
} }

View File

@ -59,7 +59,6 @@ export class UserNotificationService {
return this.authHttp.post(url, body, { context }) return this.authHttp.post(url, body, { context })
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => this.peertubeSocket.dispatchNotificationEvent('read')), tap(() => this.peertubeSocket.dispatchNotificationEvent('read')),
catchError(res => this.restExtractor.handleError(res)) catchError(res => this.restExtractor.handleError(res))
) )
@ -71,7 +70,6 @@ export class UserNotificationService {
return this.authHttp.post(url, {}, { context }) return this.authHttp.post(url, {}, { context })
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')), tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')),
catchError(res => this.restExtractor.handleError(res)) catchError(res => this.restExtractor.handleError(res))
) )
@ -81,10 +79,7 @@ export class UserNotificationService {
const url = UserNotificationService.BASE_NOTIFICATION_SETTINGS const url = UserNotificationService.BASE_NOTIFICATION_SETTINGS
return this.authHttp.put(url, settings) return this.authHttp.put(url, settings)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
private formatNotification (notification: UserNotificationServer) { private formatNotification (notification: UserNotificationServer) {

View File

@ -42,10 +42,7 @@ export class VideoCaptionService {
removeCaption (videoId: number | string, language: string) { removeCaption (videoId: number | string, language: string) {
return this.authHttp.delete(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`) return this.authHttp.delete(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
addCaption (videoId: number | string, language: string, captionfile: File) { addCaption (videoId: number | string, language: string, captionfile: File) {
@ -53,14 +50,11 @@ export class VideoCaptionService {
const data = objectToFormData(body) const data = objectToFormData(body)
return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`, data) return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`, data)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) { updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) {
let obs = of(true) let obs: Observable<any> = of(undefined)
for (const videoCaption of videoCaptions) { for (const videoCaption of videoCaptions) {
if (videoCaption.action === 'CREATE') { if (videoCaption.action === 'CREATE') {

View File

@ -69,18 +69,12 @@ export class VideoChannelService {
createVideoChannel (videoChannel: VideoChannelCreate) { createVideoChannel (videoChannel: VideoChannelCreate) {
return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel) return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) { updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) {
return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel) return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
changeVideoChannelImage (videoChannelName: string, avatarForm: FormData, type: 'avatar' | 'banner') { changeVideoChannelImage (videoChannelName: string, avatarForm: FormData, type: 'avatar' | 'banner') {
@ -94,17 +88,11 @@ export class VideoChannelService {
const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/' + type const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/' + type
return this.authHttp.delete(url) return this.authHttp.delete(url)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
removeVideoChannel (videoChannel: VideoChannel) { removeVideoChannel (videoChannel: VideoChannel) {
return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost) return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
} }

View File

@ -1,6 +1,6 @@
import { SortMeta } from 'primeng/api' import { SortMeta } from 'primeng/api'
import { concat, Observable } from 'rxjs' import { concat, Observable } from 'rxjs'
import { catchError, map, toArray } from 'rxjs/operators' import { catchError, toArray } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http' import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { RestExtractor, RestPagination, RestService } from '@app/core' import { RestExtractor, RestPagination, RestService } from '@app/core'
@ -23,10 +23,7 @@ export class RedundancyService {
const body = { redundancyAllowed } const body = { redundancyAllowed }
return this.authHttp.put(url, body) return this.authHttp.put(url, body)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
listVideoRedundancies (options: { listVideoRedundancies (options: {
@ -65,9 +62,6 @@ export class RedundancyService {
private removeRedundancy (redundancyId: number) { private removeRedundancy (redundancyId: number) {
return this.authHttp.delete(RedundancyService.BASE_REDUNDANCY_URL + '/videos/' + redundancyId) return this.authHttp.delete(RedundancyService.BASE_REDUNDANCY_URL + '/videos/' + redundancyId)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
} }

View File

@ -25,10 +25,7 @@ export class VideoOwnershipService {
} }
return this.authHttp.post(url, body) return this.authHttp.post(url, body)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
getOwnershipChanges (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoChangeOwnership>> { getOwnershipChanges (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoChangeOwnership>> {
@ -47,18 +44,12 @@ export class VideoOwnershipService {
acceptOwnership (id: number, input: VideoChangeOwnershipAccept) { acceptOwnership (id: number, input: VideoChangeOwnershipAccept) {
const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/accept' const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/accept'
return this.authHttp.post(url, input) return this.authHttp.post(url, input)
.pipe( .pipe(catchError(this.restExtractor.handleError))
map(this.restExtractor.extractDataBool),
catchError(this.restExtractor.handleError)
)
} }
refuseOwnership (id: number) { refuseOwnership (id: number) {
const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/refuse' const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/refuse'
return this.authHttp.post(url, {}) return this.authHttp.post(url, {})
.pipe( .pipe(catchError(this.restExtractor.handleError))
map(this.restExtractor.extractDataBool),
catchError(this.restExtractor.handleError)
)
} }
} }

View File

@ -114,10 +114,7 @@ export class VideoService {
const data = objectToFormData(body) const data = objectToFormData(body)
return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${video.id}`, data) return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${video.id}`, data)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
uploadVideo (video: FormData) { uploadVideo (video: FormData) {
@ -449,9 +446,6 @@ export class VideoService {
return this.authHttp return this.authHttp
.put(url, body) .put(url, body)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
} }

View File

@ -1,7 +1,7 @@
import { omit } from 'lodash-es' import { omit } from 'lodash-es'
import { SortMeta } from 'primeng/api' import { SortMeta } from 'primeng/api'
import { Observable } from 'rxjs' import { Observable } from 'rxjs'
import { catchError, map } from 'rxjs/operators' import { catchError } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http' import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { RestExtractor, RestPagination, RestService } from '@app/core' import { RestExtractor, RestPagination, RestService } from '@app/core'
@ -77,40 +77,28 @@ export class AbuseService {
const body = omit(parameters, [ 'id' ]) const body = omit(parameters, [ 'id' ])
return this.authHttp.post(url, body) return this.authHttp.post(url, body)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
updateAbuse (abuse: AdminAbuse, abuseUpdate: AbuseUpdate) { updateAbuse (abuse: AdminAbuse, abuseUpdate: AbuseUpdate) {
const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id
return this.authHttp.put(url, abuseUpdate) return this.authHttp.put(url, abuseUpdate)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
removeAbuse (abuse: AdminAbuse) { removeAbuse (abuse: AdminAbuse) {
const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id
return this.authHttp.delete(url) return this.authHttp.delete(url)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
addAbuseMessage (abuse: UserAbuse, message: string) { addAbuseMessage (abuse: UserAbuse, message: string) {
const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages' const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages'
return this.authHttp.post(url, { message }) return this.authHttp.post(url, { message })
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
listAbuseMessages (abuse: UserAbuse) { listAbuseMessages (abuse: UserAbuse) {
@ -126,10 +114,7 @@ export class AbuseService {
const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages/' + abuseMessage.id const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages/' + abuseMessage.id
return this.authHttp.delete(url) return this.authHttp.delete(url)
.pipe( .pipe(catchError(res => this.restExtractor.handleError(res)))
map(this.restExtractor.extractDataBool),
catchError(res => this.restExtractor.handleError(res))
)
} }
getPrefefinedReasons (type: AbuseFilter) { getPrefefinedReasons (type: AbuseFilter) {

View File

@ -108,7 +108,6 @@ export class UserSubscriptionService {
return this.authHttp.delete(url) return this.authHttp.delete(url)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => { tap(() => {
this.myAccountSubscriptionCache[nameWithHost] = false this.myAccountSubscriptionCache[nameWithHost] = false
@ -124,7 +123,6 @@ export class UserSubscriptionService {
const body = { uri: nameWithHost } const body = { uri: nameWithHost }
return this.authHttp.post(url, body) return this.authHttp.post(url, body)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => { tap(() => {
this.myAccountSubscriptionCache[nameWithHost] = true this.myAccountSubscriptionCache[nameWithHost] = true

View File

@ -114,10 +114,7 @@ export class VideoCommentService {
return this.authHttp return this.authHttp
.delete(url) .delete(url)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
deleteVideoComments (comments: { videoId: number | string, commentId: number }[]) { deleteVideoComments (comments: { videoId: number | string, commentId: number }[]) {

View File

@ -154,7 +154,6 @@ export class VideoPlaylistService {
return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id, data) return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id, data)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => { tap(() => {
if (!this.myAccountPlaylistCache) return if (!this.myAccountPlaylistCache) return
@ -170,7 +169,6 @@ export class VideoPlaylistService {
removeVideoPlaylist (videoPlaylist: VideoPlaylist) { removeVideoPlaylist (videoPlaylist: VideoPlaylist) {
return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id) return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => { tap(() => {
if (!this.myAccountPlaylistCache) return if (!this.myAccountPlaylistCache) return
@ -207,7 +205,6 @@ export class VideoPlaylistService {
updateVideoOfPlaylist (playlistId: number, playlistElementId: number, body: VideoPlaylistElementUpdate, videoId: number) { updateVideoOfPlaylist (playlistId: number, playlistElementId: number, body: VideoPlaylistElementUpdate, videoId: number) {
return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId, body) return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId, body)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => { tap(() => {
const existsResult = this.videoExistsCache[videoId] const existsResult = this.videoExistsCache[videoId]
@ -227,7 +224,6 @@ export class VideoPlaylistService {
removeVideoFromPlaylist (playlistId: number, playlistElementId: number, videoId?: number) { removeVideoFromPlaylist (playlistId: number, playlistElementId: number, videoId?: number) {
return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId) return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId)
.pipe( .pipe(
map(this.restExtractor.extractDataBool),
tap(() => { tap(() => {
if (!videoId) return if (!videoId) return
@ -249,10 +245,7 @@ export class VideoPlaylistService {
} }
return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body) return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body)
.pipe( .pipe(catchError(err => this.restExtractor.handleError(err)))
map(this.restExtractor.extractDataBool),
catchError(err => this.restExtractor.handleError(err))
)
} }
getPlaylistVideos (options: { getPlaylistVideos (options: {