Skip to content

Commit

Permalink
feat(shareMap): add message error
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Feb 19, 2018
1 parent 3b0caeb commit 958dd2d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/share-map/shared/share-map.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, Optional } from '@angular/core';

import { RouteService, ConfigService } from '../../core';
import { RouteService, ConfigService, MessageService } from '../../core';
import { IgoMap } from '../../map';
import { ContextService } from '../../context';

Expand All @@ -11,6 +11,7 @@ export class ShareMapService {

constructor(private config: ConfigService,
private contextService: ContextService,
private messageService: MessageService,
@Optional() private route: RouteService) {

this.urlApi = this.config.getConfig('context.url');
Expand All @@ -28,7 +29,12 @@ export class ShareMapService {
context.scope = 'public';
context.title = formValues.title;
context.uri = formValues.uri;
this.contextService.create(context).subscribe((rep) => {});
this.contextService.create(context).subscribe(
(rep) => {},
(err) => {
this.messageService.error(err.error.message, 'Share Map');
}
);
return `${location.origin + location.pathname}?context=${formValues.uri}`;
}

Expand Down

0 comments on commit 958dd2d

Please sign in to comment.