Skip to content

Commit

Permalink
Add type and do some minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanfranklin committed Sep 6, 2024
1 parent c352ac9 commit f6f6de4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit, AfterContentChecked } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { BsModalRef } from 'ngx-foundation';
import { FormGroup, FormControl } from '@angular/forms';
import { ProjectsService } from '../../services/projects.service';
Expand Down Expand Up @@ -87,7 +88,7 @@ export class ModalCreateProjectComponent implements OnInit, AfterContentChecked
(project) => {
this.close(project);
},
(err) => {
(err: HttpErrorResponse) => {
if (err.status === 409) {
this.errorMessage = 'That folder is already syncing with a different map!';
} else {
Expand Down
15 changes: 5 additions & 10 deletions angular/src/app/services/projects.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { BehaviorSubject, Observable, ReplaySubject, combineLatest } from 'rxjs';
import { Project, ProjectRequest, ProjectUpdateRequest } from '../models/models';
import { IpanelsDisplay, defaultPanelsDisplay } from '../models/ui';
Expand Down Expand Up @@ -112,15 +112,10 @@ export class ProjectsService {

create(data: ProjectRequest): Observable<Project> {
return this.http.post<Project>(this.envService.apiUrl + `/projects/`, data).pipe(
tap(
(proj) => {
// Spread operator, just pushes the new project into the array
this._projects.next([...this._projects.value, proj]);
},
(error) => {
console.log(error);
}
)
tap((proj) => {
// Spread operator, just pushes the new project into the array
this._projects.next([...this._projects.value, proj]);
})
);
}

Expand Down

0 comments on commit f6f6de4

Please sign in to comment.