Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dimakuba committed Feb 13, 2017
1 parent c6553c4 commit 3dee8a2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {ActivatedRoute, Router} from "@angular/router";
import { NotificationService } from "../../../services/notification-service";
import { CustomersContactsService } from "../customers-contacts.service";
import {Contact} from "../../model/contact";
import {Entity} from "../../../shared/entity.model";

@Component({
selector: 'contacts-update',
Expand Down Expand Up @@ -37,7 +38,7 @@ export class ContactsUpdateComponent implements OnInit {
return this.route.snapshot.data['update'];
}

onSubmit(entity: Contact) {
onSubmit(entity) {
this.customersContactsService.updateResource(entity)
.subscribe(() => {
this.notifications.createNotification('success', 'SUCCESS', 'customers.successUpdateContact');
Expand Down
26 changes: 17 additions & 9 deletions modules/admin/src/app/customers/model/contact.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
export interface Contact {
firstname: string,
surname: string,
phone: string,
mobilePhone: string,
fax: string,
emailAddress: string,
type: string,
salutation: string
import {Link, Entity} from "../../shared/entity.model";

interface Links {
self: Link;
customer: Link;
}

export interface Contact extends Entity {
firstname: string;
surname: string;
phone: string;
mobilePhone: string;
fax: string;
emailAddress: string;
type: string;
salutation: string;
_links: Links;
}
28 changes: 18 additions & 10 deletions modules/admin/src/app/customers/model/customer-user.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
export interface CustomerUser {
username: string,
password: string,
salt: string,
firstname: string,
surname: string,
email: string,
active: boolean,
created: string,
blocked: boolean
import {Link, Entity} from "../../shared/entity.model";

interface Links {
self: Link;
customer: Link;
}

export interface CustomerUser extends Entity {
username: string;
password: string;
salt: string;
firstname: string;
surname: string;
email: string;
active: boolean;
created: string;
blocked: boolean;
_links: Links;
}
16 changes: 2 additions & 14 deletions modules/admin/src/app/shared/crud-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export abstract class CrudRepository<T> {

this.loading = true;

return this.intercept(this.http.request(entity._links.self.href, requestOptions)
return this.http.request(entity._links.self.href, requestOptions)
.map((response: Response) => <T>response.json())
.share());
.share();
}

/**
Expand Down Expand Up @@ -140,16 +140,4 @@ export abstract class CrudRepository<T> {
.map((response: Response) => <T[]>response.json())
.share();
}

intercept<T extends Entity>(observable: Rx.Observable<T>): Rx.Observable<T> {
return Rx.Observable.create(obs => {
observable.subscribe(res => {
this.loading = false;
obs.next(res);
}, err => {
this.loading = false;
obs.error(err);
});
});
}
}

0 comments on commit 3dee8a2

Please sign in to comment.