mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
import { AddClientForm, ClientsState } from '@app/shared';
|
|
|
|
@Component({
|
|
selector: 'sqx-client-add-form',
|
|
styleUrls: ['./client-add-form.component.scss'],
|
|
templateUrl: './client-add-form.component.html',
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class ClientAddFormComponent {
|
|
public addClientForm = new AddClientForm();
|
|
|
|
constructor(
|
|
private readonly clientsState: ClientsState,
|
|
) {
|
|
}
|
|
|
|
public addClient() {
|
|
const value = this.addClientForm.submit();
|
|
|
|
if (value) {
|
|
this.clientsState.attach(value)
|
|
.subscribe({
|
|
next: () => {
|
|
this.addClientForm.submitCompleted();
|
|
},
|
|
error: error => {
|
|
this.addClientForm.submitFailed(error);
|
|
},
|
|
});
|
|
}
|
|
}
|
|
|
|
public cancel() {
|
|
this.addClientForm.submitCompleted();
|
|
}
|
|
}
|
|
|