diff --git a/src/view/team-add.js b/src/view/team-add.js index afd207c..92e923a 100644 --- a/src/view/team-add.js +++ b/src/view/team-add.js @@ -1,8 +1,8 @@ export default { props: { teamAEdit: { - type: String, - require: true + require: true, + default: "" }, }, data: function() { @@ -18,6 +18,12 @@ export default { addTeam: function () { try { + if (this.teamAEdit != null) { + this.id = this.teamAEdit.id + this.name = this.teamAEdit.name + this.description = this.teamAEdit.description + } + this.errorMessage = ''; if (!this.id) { throw new RequiredFieldError("ID"); @@ -35,11 +41,13 @@ export default { throw new StringSize("Name", NAME_MINIMAL_SIZE) } - const team = { id: this.id, name: this.name, description: this.description}; + const team = { id: this.id, name: this.name, description: this.description }; + if (this.teamAEdit != null) { this.$emit('teamModifie', team); } else { + this.$emit('teamAjoute', team); } @@ -47,7 +55,7 @@ export default { this.name = ''; this.description = ''; - }catch (error) { + } catch (error) { if (error instanceof RequiredFieldError) { this.errorMessage=error } @@ -56,22 +64,25 @@ export default { } return null; } - }, + } }, template: `
{{ errorMessage }}

- +

+


- +

+


- +