Changeset View
Changeset View
Standalone View
Standalone View
src/app/_models/superPost.ts
Show All 16 Lines | export class SuperPost { | ||||
} | } | ||||
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 | // Sort posts | ||||
results.sort((a: Post, b: Post) => { | results.sort((a: Post, b: Post) => { | ||||
return b.created.getTime() - a.created.getTime(); | return new Date(b.created).getTime() - new Date(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; | ||||
} | } | ||||
} | } |