Changeset View
Changeset View
Standalone View
Standalone View
src/app/_models/superPost.ts
Show All 15 Lines | static parse(obj: any) { | ||||
); | ); | ||||
} | } | ||||
constructor( | constructor( | ||||
public count: number, | public count: number, | ||||
public next: string, | public next: string, | ||||
public previous: string, | public previous: string, | ||||
public results: Post[] | public results: Post[] | ||||
) { | ) { } | ||||
// Sort posts | |||||
results.sort((a: Post, b: Post) => { | |||||
return b.created.getTime() - a.created.getTime(); | |||||
}); | |||||
} | |||||
getError(): SuperPostError { | getError(): SuperPostError { | ||||
return null; | return null; | ||||
} | } | ||||
} | } | ||||
export class SuperPostError extends SuperPost { | export class SuperPostError extends SuperPost { | ||||
constructor( | constructor( | ||||
public non_field_errors?: string[], | public non_field_errors?: string[], | ||||
public _text?: string[] | public text?: string[] | ||||
) { | ) { | ||||
super(null, null, null, null); | super(null, null, null, null); | ||||
} | } | ||||
getError(): SuperPostError { | getError(): SuperPostError { | ||||
return this; | return this; | ||||
} | } | ||||
} | } |