🚧 Fetching av feilmeldinger fra DB til frontend i form av Promises
WIP: klarer ikke konvertere Promise<any> til Feilmelding[] Co-authored-by: Sindre Kjelsrud <sindre.kjelsrud@nav.no>
This commit is contained in:
parent
eb470e3c9e
commit
02f999c56b
7 changed files with 97 additions and 66 deletions
|
|
@ -3,9 +3,28 @@
|
|||
*/
|
||||
|
||||
|
||||
interface Feilmelding {
|
||||
tittel: String,
|
||||
beskrivelse: String
|
||||
haster: boolean
|
||||
export interface IFeilmelding {
|
||||
tittel: string,
|
||||
beskrivelse: string
|
||||
// haster: boolean
|
||||
dato: Date
|
||||
}
|
||||
|
||||
export class Feilmelding implements IFeilmelding {
|
||||
tittel: string = "default tittel"
|
||||
beskrivelse: string = "default beskrivelse"
|
||||
dato: Date = new Date()
|
||||
|
||||
/**
|
||||
* Typescript 2.1 syntax som lar deg sende inn et JSON object og mappe det til class.
|
||||
* https://stackoverflow.com/questions/14142071/typescript-and-field-initializers
|
||||
*/
|
||||
public constructor(
|
||||
fields: {
|
||||
tittel: string,
|
||||
beskrivelse: string,
|
||||
dato: Date
|
||||
}) {
|
||||
if (fields) Object.assign(this, fields);
|
||||
}
|
||||
}
|
||||
Reference in a new issue