Skip to content

Commit b28631d

Browse files
author
Andrew Evans
committed
resolving null error on payload
1 parent e202e58 commit b28631d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/app/weather/location.actions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export class LocationAction implements Action {
1717
export class LoadLocations implements Action {
1818
readonly type = LocationActionTypes.LoadLocations;
1919

20-
constructor(readonly payload: {locationData: LocationData, error: null}) {
20+
constructor(readonly payload: {locationData: LocationData}) {
2121

2222
}
2323
}
2424

2525
export class LocationsError implements Action {
2626
readonly type = LocationActionTypes.LocationsError;
2727

28-
constructor(readonly payload: {locationData: null, error: string}) {
28+
constructor(readonly payload: {error: string}) {
2929

3030
}
3131
}

src/app/weather/weather.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class WeatherComponent implements OnInit {
180180
}
181181
}
182182

183-
this.store.dispatch(new LoadLocations({locationData: this.locationData, error: null}));
183+
this.store.dispatch(new LoadLocations({locationData: this.locationData}));
184184
}
185185

186186
onSelectionChanged(event: MatAutocompleteSelectedEvent) {
@@ -191,7 +191,7 @@ export class WeatherComponent implements OnInit {
191191
this.locationData.latitude = latitude.toFixed(4).toString();
192192
this.locationData.longitude = longitude.toFixed(4).toString();
193193
this.store.dispatch(new LoadWeather({weatherData: null}));
194-
this.store.dispatch(new LoadLocations({locationData: this.locationData, error: null}));
194+
this.store.dispatch(new LoadLocations({locationData: this.locationData}));
195195
break;
196196
}
197197
}

src/app/weather/weather.effects.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class WeatherEffects {
2020
map(weather => {
2121
return (new LoadWeather({weatherData: weather}));
2222
}),
23-
catchError((errorMessage) => of(new LocationsError({locationData: null, error: errorMessage})))
23+
catchError((errorMessage) => of(new LocationsError({error: errorMessage})))
2424
))
2525
);
2626

0 commit comments

Comments
 (0)