Skip to content

Commit 59c79a6

Browse files
committed
lint cleanup
1 parent b3295f9 commit 59c79a6

File tree

8 files changed

+74
-70
lines changed

8 files changed

+74
-70
lines changed

src/app/app-state.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Injectable } from '@angular/core';
2-
import { Subject } from 'rxjs';
2+
import { Subject } from 'rxjs';
33

44
@Injectable({
55
providedIn: 'root'
66
})
77
export class AppStateService {
8-
public _subject = new Subject<any>();
9-
public event = this._subject.asObservable();
8+
public subject = new Subject<any>();
9+
public event = this.subject.asObservable();
1010

11-
public publish(data: any){
12-
this._subject.next(data);
11+
public publish(data: any) {
12+
this.subject.next(data);
1313
}
1414
}

src/app/cities-reference.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ const querySting = require('query-string');
88
})
99
export class CitiesReferenceService {
1010

11-
url = 'http://localhost:3000/cities'
11+
url = 'http://localhost:3000/cities';
1212

13-
constructor (private http: HttpClient) { }
13+
constructor(private http: HttpClient) { }
1414

15-
getCities ({ state, country }) : Observable<any> {
15+
getCities({ state, country }): Observable<any> {
1616
return this.http.get([
1717
this.url,
1818
'?',
1919
querySting.stringify({
20-
state: state,
21-
country: country
20+
state,
21+
country
2222
})
23-
].join(''))
23+
].join(''));
2424
}
2525
}

src/app/city.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
import { Injectable } from '@angular/core';
22
import { HttpClient } from '@angular/common/http';
33
import { Observable } from 'rxjs';
4-
const queryString = require('query-string')
4+
const queryString = require('query-string');
55

66
@Injectable({
77
providedIn: 'root'
88
})
99
export class CityService {
1010

11-
url = 'http://localhost:3000/cities'
11+
url = 'http://localhost:3000/cities';
1212

13-
constructor(private http:HttpClient) { }
13+
constructor(private http: HttpClient) { }
1414

15-
getData ({ city, state, country }) : Observable<any> {
16-
const cityName = city
15+
getData({ city, state, country }): Observable<any> {
16+
const cityName = city;
1717
return this.http.get([
1818
this.url,
1919
'/',
2020
cityName,
2121
'?',
2222
queryString.stringify({
23-
state: state,
24-
country: country
23+
state,
24+
country
2525
})
26-
].join(''))
26+
].join(''));
2727
}
2828
}

src/app/configure/configure.page.ts

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,97 +19,99 @@ export class ConfigurePage {
1919
selectedState: any;
2020
selectedCity: any;
2121

22-
constructor (
22+
constructor(
2323
private browserStorageService: BrowserStorageService,
2424
private countriesReferenceService: CountriesReferenceService,
2525
private statesReferenceService: StatesReferenceService,
2626
private citiesReferenceService: CitiesReferenceService,
2727
private appStateService: AppStateService
2828
) {
2929
this.loadCountries().then(() => {
30-
this.selectedCountry = browserStorageService.getLocal('selectedCountry') || ''
31-
if (this.selectedCountry)
30+
this.selectedCountry = browserStorageService.getLocal('selectedCountry') || '';
31+
if (this.selectedCountry) {
3232
this._loadStates(this.selectedCountry).then(res => {
33-
if (this.selectedState)
34-
this._loadCities(this.selectedState)
35-
})
36-
})
33+
if (this.selectedState) {
34+
this._loadCities(this.selectedState);
35+
}
36+
});
37+
}
38+
});
3739
}
3840

3941
/**
4042
* selectedCityHandler
4143
*/
42-
selectedCityHandler (selectedCity) {
43-
this.selectedCity = selectedCity;
44+
selectedCityHandler(city) {
45+
this.selectedCity = city;
4446
this.browserStorageService.setLocal('selectedCity', this.selectedCity);
4547
this.appStateService.publish({
46-
selectedCity: selectedCity,
48+
selectedCity: city,
4749
selectedState: this.selectedState,
4850
selectedCountry: this.selectedCountry
4951
});
5052
}
5153

52-
_loadCities (selectedState) {
54+
_loadCities(selectedState) {
5355
this.citiesReferenceService.getCities({
5456
state: selectedState,
5557
country: this.selectedCountry
5658
})
5759
.subscribe((citiesRef) => {
5860
this.cities = citiesRef._embedded;
59-
this.selectedCity = this.browserStorageService.getLocal('selectedCity') || ''
61+
this.selectedCity = this.browserStorageService.getLocal('selectedCity') || '';
6062
}, (e) => {
61-
console.log({ error: e })
62-
})
63+
console.log({ error: e });
64+
});
6365
}
6466

6567
/**
6668
* selectedStateHandler
6769
*/
68-
selectedStateHandler (selectedState) {
70+
selectedStateHandler(selectedState) {
6971
this.selectedState = selectedState;
7072
this.browserStorageService.setLocal('selectedState', this.selectedState);
7173

72-
this._loadCities(selectedState)
74+
this._loadCities(selectedState);
7375
}
7476

75-
_loadStates (selectedCountry) {
77+
_loadStates(selectedCountry) {
7678
return new Promise((res, rej) => {
7779
this.statesReferenceService.getStates({ country: selectedCountry })
7880
.subscribe((statesRef) => {
7981
this.states = statesRef._embedded;
80-
this.selectedState = this.browserStorageService.getLocal('selectedState') || ''
81-
res(statesRef)
82+
this.selectedState = this.browserStorageService.getLocal('selectedState') || '';
83+
res(statesRef);
8284
}, (e) => {
8385
console.log({ error: e });
84-
rej({ error: e })
86+
rej({ error: e });
8587
});
86-
})
88+
});
8789
}
8890

8991
/**
9092
* selectedCountryHandler
9193
*/
92-
selectedCountryHandler (selectedCountry) {
94+
selectedCountryHandler(selectedCountry) {
9395
this.selectedCountry = selectedCountry;
9496
this.browserStorageService.setLocal('selectedCountry', this.selectedCountry);
9597
this._loadStates(selectedCountry).then(res => {
96-
console.log(res)
97-
})
98+
console.log(res);
99+
});
98100
}
99101

100102
/**
101103
* loadCountries
102104
*/
103-
loadCountries () {
105+
loadCountries() {
104106
return new Promise((res, rej) => {
105107
this.countriesReferenceService.getCountries()
106-
.subscribe((countriesRef) => {
107-
this.countries = countriesRef._embedded;
108-
res(countriesRef)
109-
}, (e) => {
110-
console.log({ error: e });
111-
rej({ error: e });
112-
});
108+
.subscribe((countriesRef) => {
109+
this.countries = countriesRef._embedded;
110+
res(countriesRef);
111+
}, (e) => {
112+
console.log({ error: e });
113+
rej({ error: e });
114+
});
113115
});
114116
}
115117

src/app/countries-reference.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export class CountriesReferenceService {
1010

1111
url = 'http://localhost:3000/countries';
1212

13-
constructor (private http: HttpClient) { }
13+
constructor(private http: HttpClient) { }
1414

15-
getCountries () : Observable<any> {
16-
return this.http.get(this.url)
15+
getCountries(): Observable<any> {
16+
return this.http.get(this.url);
1717
}
1818
}

src/app/profile/profile.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CommonModule } from '@angular/common';
55
import { FormsModule } from '@angular/forms';
66
import { ProfilePage } from './profile.page';
77

8-
import { ProfilePageRoutingModule } from './profile-routing.module'
8+
import { ProfilePageRoutingModule } from './profile-routing.module';
99

1010
@NgModule({
1111
imports: [

src/app/states-reference.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { HttpClient } from '@angular/common/http';
33
import { Observable } from 'rxjs';
4-
const queryString = require('query-string')
4+
const queryString = require('query-string');
55

66

77
@Injectable({
@@ -12,13 +12,13 @@ export class StatesReferenceService {
1212
url = 'http://localhost:3000/states';
1313
qs = '?';
1414

15-
constructor (private http: HttpClient) { }
15+
constructor(private http: HttpClient) { }
1616

17-
getStates ({ country }) : Observable<any> {
17+
getStates({ country }): Observable<any> {
1818
return this.http.get([
1919
this.url,
2020
this.qs,
21-
queryString.stringify({ country: country })
21+
queryString.stringify({ country })
2222
].join(''));
2323
}
2424

src/app/weather/weather.page.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import { AppStateService } from '../app-state.service';
99
styleUrls: ['weather.page.scss']
1010
})
1111
export class WeatherPage implements OnInit {
12-
weatherIconIndex:object = {
12+
13+
weatherIconIndex: object = {
1314
'01d': {
1415
description: 'clear sky (day)'
1516
},
@@ -49,7 +50,7 @@ export class WeatherPage implements OnInit {
4950
'50n': {
5051
description: 'mist (night)'
5152
}
52-
}
53+
};
5354

5455
sub: any;
5556

@@ -81,9 +82,10 @@ export class WeatherPage implements OnInit {
8182
}
8283
},
8384
};
85+
8486
altIcon = {
8587
description: null
86-
}
88+
};
8789

8890
constructor(
8991
private browserStorageService: BrowserStorageService,
@@ -105,7 +107,6 @@ export class WeatherPage implements OnInit {
105107

106108
ngOnInit() {
107109

108-
console.log(this.selectedCity)
109110
if (this.selectedCountry && this.selectedState && this.selectedCity) {
110111
this.loadCityData({
111112
city: this.selectedCity,
@@ -115,14 +116,15 @@ export class WeatherPage implements OnInit {
115116
}
116117
}
117118

118-
loadCityData ({ city, state, country }) {
119-
this.sub = this.cityService.getData({ city, state, country }).subscribe(cityRef => {
120-
this.selectedCityData = cityRef && cityRef.data ? cityRef.data : {}
119+
loadCityData({ city, state, country }) {
120+
this.sub = this.cityService.getData({ city, state, country })
121+
.subscribe(cityRef => {
122+
this.selectedCityData = cityRef && cityRef.data ? cityRef.data : {};
121123

122-
this.altIcon = this.weatherIconIndex[this.selectedCityData.current.weather.ic] || this.altIcon
123-
}, e => {
124-
console.log({ error: e })
125-
})
124+
this.altIcon = this.weatherIconIndex[this.selectedCityData.current.weather.ic] || this.altIcon;
125+
}, e => {
126+
console.log({ error: e });
127+
});
126128
}
127129

128130
}

0 commit comments

Comments
 (0)