Last active
June 25, 2020 19:52
-
-
Save wellington1993/d53c655ee5f4c425d00dec1d04b1b65e to your computer and use it in GitHub Desktop.
Marcas index Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { action } from '@ember/object'; | |
import { inject as service } from '@ember/service'; | |
import { tracked } from '@glimmer/tracking'; | |
import Component from '@glimmer/component'; | |
export default class MarcasIndexComponent extends Component { | |
@service store; | |
@tracked errors; | |
@tracked loading='Carregando...'; | |
@tracked marcas; | |
constructor(owner, args) { | |
super(owner, args); | |
this.store.findAll('marca').then( (marcas) => { | |
this.marcas = marcas; | |
}, (errors) => { | |
this.loading = 'Falha no carregamento!'; | |
this.errors = errors; | |
}); | |
} | |
@action | |
deleteMarca(marca) { | |
marca.destroyRecord(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment