1
0
Fork 0

Reduce history method names

This commit is contained in:
Chocobozzz 2022-01-18 11:25:52 +01:00
parent 7177b46ca1
commit c1f7a737cf
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 6 additions and 6 deletions

View file

@ -95,7 +95,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
getVideosObservable (page: number) {
const newPagination = immutableAssign(this.pagination, { currentPage: page })
return this.userHistoryService.getUserVideosHistory(newPagination, this.search)
return this.userHistoryService.list(newPagination, this.search)
.pipe(
tap(res => this.pagination.totalItems = res.total)
)
@ -124,7 +124,7 @@ export class MyHistoryComponent implements OnInit, DisableForReuseHook {
}
deleteHistoryElement (video: Video) {
this.userHistoryService.deleteUserVideoHistoryElement(video)
this.userHistoryService.deleteElement(video)
.subscribe({
next: () => {
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)
if (res !== true) return
this.userHistoryService.clearAllUserVideosHistory()
this.userHistoryService.clearAll()
.subscribe({
next: () => {
this.notifier.success($localize`Videos history deleted`)

View file

@ -18,7 +18,7 @@ export class UserHistoryService {
private videoService: VideoService
) {}
getUserVideosHistory (historyPagination: ComponentPaginationLight, search?: string) {
list (historyPagination: ComponentPaginationLight, search?: string) {
const pagination = this.restService.componentToRestPagination(historyPagination)
let params = new HttpParams()
@ -34,13 +34,13 @@ export class UserHistoryService {
)
}
deleteUserVideoHistoryElement (video: Video) {
deleteElement (video: Video) {
return this.authHttp
.delete(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/' + video.id)
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
clearAllUserVideosHistory () {
clearAll () {
return this.authHttp
.post(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/remove', {})
.pipe(