web/admin: fix message when object is created
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
0804b5e6c5
commit
fac8d53163
|
@ -41,6 +41,10 @@ export class Form<T> extends LitElement {
|
|||
`];
|
||||
}
|
||||
|
||||
getSuccessMessage(): string {
|
||||
return this.successMessage;
|
||||
}
|
||||
|
||||
serializeForm(form: IronFormElement): T {
|
||||
const elements = form._getSubmittableElements();
|
||||
const json: { [key: string]: unknown } = {};
|
||||
|
@ -69,7 +73,7 @@ export class Form<T> extends LitElement {
|
|||
return this.send(data).then((r) => {
|
||||
showMessage({
|
||||
level: MessageLevel.success,
|
||||
message: this.successMessage
|
||||
message: this.getSuccessMessage()
|
||||
});
|
||||
return r;
|
||||
}).catch((ex: Response) => {
|
||||
|
|
|
@ -16,7 +16,13 @@ export class GroupForm extends Form<Group> {
|
|||
@property({attribute: false})
|
||||
group?: Group;
|
||||
|
||||
successMessage = gettext("Successfully updated group");
|
||||
getSuccessMessage(): string {
|
||||
if (this.group) {
|
||||
return gettext("Successfully updated group");
|
||||
} else {
|
||||
return gettext("Successfully created group");
|
||||
}
|
||||
}
|
||||
|
||||
send = (data: Group): Promise<Group> => {
|
||||
if (this.group) {
|
||||
|
|
Reference in New Issue