Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -39296,7 +39296,7 @@ function __importDefault(mod) {
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

!function(n,t){ true?t(exports):undefined}(this,function(n){"use strict";function t(n,t,e){return{type:n,payload:t,meta:e}}function e(n,t){if(void 0===t&&(t=1),null==n)throw new Error("Argument (#"+t+") is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument (#"+t+") should be of type: string | symbol")}function r(n,t){var e=null!=t?t(n):function(){return{type:n}};return Object.assign(e,{getType:function(){return n}})}n.action=t,n.createAction=function(n,r){e(n);var i=null==r?function(){return t(n)}:r(t.bind(null,n));return Object.assign(i,{getType:function(){return n}})},n.createStandardAction=function(n){return e(n),Object.assign(function(){return r(n,function(n){return function(t,e){return{type:n,payload:t,meta:e}}})},{map:function(t){return r(n,function(n){return function(e,r){return Object.assign(t(e,r),{type:n})}})}})},n.createAsyncAction=function(n,t,i){return[n,t,i].forEach(function(n,t){e(n,t+1)}),Object.assign(function(){return{request:r(n,function(t){return function(t){return{type:n,payload:t}}}),success:r(t,function(n){return function(n){return{type:t,payload:n}}}),failure:r(i,function(n){return function(n){return{type:i,payload:n}}})}},{})},n.getType=function(n){if(null==n)throw new Error("first argument is missing");if(null==n.getType)throw new Error('first argument is not an instance of "typesafe-actions"');return n.getType()},n.isOfType=function(n,t){e(n);var r=function(t){return t.type===n};return null==t?r:r(t)},n.isActionOf=function(n,t){if(null==n)throw new Error("first argument is missing");if(Array.isArray(n))n.forEach(function(n,t){if(null==n.getType)throw new Error('first argument contains element\n that is not created with "typesafe-actions" at index ['+t+"]")});else if(null==n.getType)throw new Error('first argument is not created with "typesafe-actions"');var e=function(t){return(Array.isArray(n)?n:[n]).some(function(n,e){return n.getType()===t.type})};return null==t?e:e(t)},n.createActionDeprecated=function(n,t){var e;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");e=t}else e=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return e.getType=function(){return n},e},Object.defineProperty(n,"__esModule",{value:!0})});
!function(n,t){ true?t(exports):undefined}(this,function(n){"use strict";function t(n,t,r){return{type:n,payload:t,meta:r}}function r(n,t){if(void 0===t&&(t=1),null==n)throw new Error("Argument (#"+t+") is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("Argument (#"+t+") should be of type: string | symbol")}function e(n,t){var r=null!=t?t(n):function(){return{type:n}};return Object.assign(r,{getType:function(){return n},toString:function(){return n}})}n.action=t,n.createAction=function(n,e){r(n);var i=null==e?function(){return t(n)}:e(t.bind(null,n));return Object.assign(i,{getType:function(){return n},toString:function(){return n}})},n.createStandardAction=function(n){return r(n),Object.assign(function(){return e(n,function(n){return function(t,r){return{type:n,payload:t,meta:r}}})},{map:function(t){return e(n,function(n){return function(r,e){return Object.assign(t(r,e),{type:n})}})}})},n.createAsyncAction=function(n,t,i){return[n,t,i].forEach(function(n,t){r(n,t+1)}),Object.assign(function(){return{request:e(n,function(t){return function(t){return{type:n,payload:t}}}),success:e(t,function(n){return function(n){return{type:t,payload:n}}}),failure:e(i,function(n){return function(n){return{type:i,payload:n}}})}},{})},n.getType=function(n){if(null==n)throw new Error("first argument is missing");if(null==n.getType)throw new Error('first argument is not an instance of "typesafe-actions"');return n.getType()},n.isOfType=function(n,t){Array.isArray(n)?n.forEach(function(n){return r(n)}):r(n);var e=Array.isArray(n)?function(t){return n.includes(t.type)}:function(t){return t.type===n};return null==t?e:e(t)},n.isActionOf=function(n,t){if(null==n)throw new Error("first argument is missing");if(Array.isArray(n))n.forEach(function(n,t){if(null==n.getType)throw new Error('first argument contains element\n that is not created with "typesafe-actions" at index ['+t+"]")});else if(null==n.getType)throw new Error('first argument is not created with "typesafe-actions"');var r=function(t){return(Array.isArray(n)?n:[n]).some(function(n,r){return n.getType()===t.type})};return null==t?r:r(t)},n.createActionDeprecated=function(n,t){var r;if(null!=t){if("function"!=typeof t)throw new Error("second argument is not a function");r=t}else r=function(){return{type:n}};if(null==n)throw new Error("first argument is missing");if("string"!=typeof n&&"symbol"!=typeof n)throw new Error("first argument should be type of: string | symbol");return r},Object.defineProperty(n,"__esModule",{value:!0})});


/***/ }),
Expand Down Expand Up @@ -39638,7 +39638,7 @@ var typesafe_actions_1 = __webpack_require__(/*! typesafe-actions */ "./node_mod
var actions = __webpack_require__(/*! ../actions */ "./src/actions/index.ts");
var Api_1 = __webpack_require__(/*! ../shared/services/Api */ "./src/shared/services/Api.ts");
var weatherGetEpic = function (action$, store) {
return action$.pipe(operators_1.filter(typesafe_actions_1.isOfType(typesafe_actions_1.getType(actions.weatherGetAction))), operators_1.switchMap(function (action) {
return action$.pipe(operators_1.filter(typesafe_actions_1.isActionOf(actions.weatherGetAction)), operators_1.switchMap(function (action) {
return rxjs_1.from(Api_1.getWeather(action.payload.lat, action.payload.lng)).pipe(operators_1.map(actions.weatherSetAction), operators_1.catchError(function (error) { return rxjs_1.of(actions.weatherErrorAction(error)); }));
}));
};
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"redux-observable": "^1.0.0",
"rxjs": "^6.3.3",
"scriptjs": "^2.5.9",
"typesafe-actions": "^2.0.4"
"typesafe-actions": "^3.0.0"
},
"devDependencies": {
"awesome-typescript-loader": "^5.2.1",
Expand Down
4 changes: 1 addition & 3 deletions src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import {
WEATHER_ERROR,
} from "../constants";

import Weather from "../shared/models/Weather";

export const weatherGetAction = createAction(WEATHER_GET, resolve => (lat: number, lng: number) => resolve({ lat, lng }));

export const weatherSetAction = createAction(WEATHER_SET, resolve => (weather: Response) => resolve(weather));

export const weatherErrorAction = createAction(WEATHER_ERROR, resolve => (error: Error) => resolve(error));

export const mapReadyAction = createAction(MAP_READY);
export const mapReadyAction = createAction(MAP_READY);
2 changes: 1 addition & 1 deletion src/components/Weather.connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const mapStateToProps = (state: RootState) => ({

const mapDispatchToProps = (dispatch: Dispatch<Action>, props: OwnProps) => ({});

export default connect(mapStateToProps, mapDispatchToProps)(Weather);
export default connect(mapStateToProps, mapDispatchToProps)(Weather);
6 changes: 3 additions & 3 deletions src/epics/WeatherEpic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Epic } from "redux-observable";
import { from, of } from 'rxjs';
import { switchMap, filter, map, catchError, mergeMap } from 'rxjs/operators';
import { ActionType, isOfType, getType } from 'typesafe-actions';
import { switchMap, filter, map, catchError } from 'rxjs/operators';
import { ActionType, isActionOf } from 'typesafe-actions';

import * as actions from "../actions";

Expand All @@ -13,7 +13,7 @@ import { getWeather } from "../shared/services/Api";

const weatherGetEpic: Epic<Action, Action, RootState> = (action$, store) =>
action$.pipe(
filter(isOfType(getType(actions.weatherGetAction))),
filter(isActionOf(actions.weatherGetAction)),
switchMap(action =>
from(getWeather(action.payload.lat, action.payload.lng)).pipe(
map(actions.weatherSetAction),
Expand Down