mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Begin user quota
This commit is contained in:
parent
e7dbeae8d9
commit
b0f9f39ed7
29 changed files with 274 additions and 55 deletions
|
@ -3,14 +3,31 @@ import { Http, RequestOptionsArgs, URLSearchParams, Response } from '@angular/ht
|
|||
import { ServerDataSource } from 'ng2-smart-table'
|
||||
|
||||
export class RestDataSource extends ServerDataSource {
|
||||
constructor (http: Http, endpoint: string) {
|
||||
private updateResponse: (input: any[]) => any[]
|
||||
|
||||
constructor (http: Http, endpoint: string, updateResponse?: (input: any[]) => any[]) {
|
||||
const options = {
|
||||
endPoint: endpoint,
|
||||
sortFieldKey: 'sort',
|
||||
dataKey: 'data'
|
||||
}
|
||||
|
||||
super(http, options)
|
||||
|
||||
if (updateResponse) {
|
||||
this.updateResponse = updateResponse
|
||||
}
|
||||
}
|
||||
|
||||
protected extractDataFromResponse (res: Response) {
|
||||
const json = res.json()
|
||||
if (!json) return []
|
||||
let data = json.data
|
||||
|
||||
if (this.updateResponse !== undefined) {
|
||||
data = this.updateResponse(data)
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
protected extractTotalFromResponse (res: Response) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue