Reduce history method names
This commit is contained in:
parent
7177b46ca1
commit
c1f7a737cf
|
@ -95,7 +95,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
|
||||||
getVideosObservable (page: number) {
|
getVideosObservable (page: number) {
|
||||||
const newPagination = immutableAssign(this.pagination, { currentPage: page })
|
const newPagination = immutableAssign(this.pagination, { currentPage: page })
|
||||||
|
|
||||||
return this.userHistoryService.getUserVideosHistory(newPagination, this.search)
|
return this.userHistoryService.list(newPagination, this.search)
|
||||||
.pipe(
|
.pipe(
|
||||||
tap(res => this.pagination.totalItems = res.total)
|
tap(res => this.pagination.totalItems = res.total)
|
||||||
)
|
)
|
||||||
|
@ -124,7 +124,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteHistoryElement (video: Video) {
|
deleteHistoryElement (video: Video) {
|
||||||
this.userHistoryService.deleteUserVideoHistoryElement(video)
|
this.userHistoryService.deleteElement(video)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.videos = this.videos.filter(v => v.id !== video.id)
|
this.videos = this.videos.filter(v => v.id !== video.id)
|
||||||
|
@ -141,7 +141,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
|
||||||
const res = await this.confirmService.confirm(message, title)
|
const res = await this.confirmService.confirm(message, title)
|
||||||
if (res !== true) return
|
if (res !== true) return
|
||||||
|
|
||||||
this.userHistoryService.clearAllUserVideosHistory()
|
this.userHistoryService.clearAll()
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.notifier.success($localize`Videos history deleted`)
|
this.notifier.success($localize`Videos history deleted`)
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class UserHistoryService {
|
||||||
private videoService: VideoService
|
private videoService: VideoService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
getUserVideosHistory (historyPagination: ComponentPaginationLight, search?: string) {
|
list (historyPagination: ComponentPaginationLight, search?: string) {
|
||||||
const pagination = this.restService.componentToRestPagination(historyPagination)
|
const pagination = this.restService.componentToRestPagination(historyPagination)
|
||||||
|
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
|
@ -34,13 +34,13 @@ export class UserHistoryService {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUserVideoHistoryElement (video: Video) {
|
deleteElement (video: Video) {
|
||||||
return this.authHttp
|
return this.authHttp
|
||||||
.delete(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/' + video.id)
|
.delete(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/' + video.id)
|
||||||
.pipe(catchError(err => this.restExtractor.handleError(err)))
|
.pipe(catchError(err => this.restExtractor.handleError(err)))
|
||||||
}
|
}
|
||||||
|
|
||||||
clearAllUserVideosHistory () {
|
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(
|
||||||
|
|
Loading…
Reference in New Issue