This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ActionsObservable, StateObservable } from 'redux-observable'; | |
... | |
it('expects to NOT work perfectly', async () => { | |
const action$ = ActionsObservable.of(action.actionRequest()); | |
const expected = [ | |
of(pushWarningSnackbar('Failed to create shareable folder')); // failed action | |
]; | |
mockAxios.onGet().reply(400, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ActionsObservable, StateObservable } from 'redux-observable'; | |
... | |
it('expects to work perfectly', async () => { | |
const mockedResponse = {}; | |
const action$ = ActionsObservable.of(action.actionRequest()); | |
const expected = [ | |
addDataAction(mockedResponse), // action 1 | |
pushInfoSnackbar('created successfully') // action 2 | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { from, of, concat } from 'rxjs'; | |
import { catchError, mergeMap, switchMap } from 'rxjs/operators'; | |
import { startSubmit, stopSubmit } from 'redux-form'; | |
const exampleEpic = action$ => | |
action$.pipe( | |
ofType(types.ACTION_REQUEST), | |
switchMap(({ payload, meta }) => // yes, meta! | |
concat( | |
of(startSubmit(meta.formName)), // Here we define that this specific form is submitting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { from, of, concat } from 'rxjs'; | |
import { catchError, mergeMap, switchMap } from 'rxjs/operators'; | |
const exampleEpic = action$ => | |
action$.pipe( | |
ofType(types.ACTION_REQUEST), | |
switchMap(({ payload }) => | |
concat( | |
of(loadingList()), // Here we define the loading action for our list | |
from(api.get(payload.data)).pipe( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { from, of } from 'rxjs'; | |
import { catchError, mergeMap, switchMap } from 'rxjs/operators'; | |
const exampleEpic = action$ => | |
action$.pipe( | |
ofType(types.ACTION_REQUEST), | |
switchMap(({ payload }) => | |
from(api.get(payload.data)).pipe( | |
mergeMap(response => | |
of( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.JSMeetup; | |
import ... | |
class JSMeetupModule extends ReactContextBaseJavaModule { | |
private static String mPremium = ""; | |
public JSMeetupModule(ReactApplicationContext reactContext) { | |
super(reactContext); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if an array has content join all parts to comma seperated string and splitted to a new array | |
const flatArray = (array) => array.length ? array.join().split(',') : []; | |
flatArray([[1,2,[3]],4]) | |
flatArray([1,2,3,4]) | |
flatArray([1,2,[3,[4,5]],6]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ngRedux from "ng-redux"; | |
import thunk from "redux-thunk"; | |
import {RootReducer} from "./Reducers"; | |
angular | |
.module( | |
"funkmartini", | |
[ | |
..., | |
ngRedux, | |
..... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {combineReducers} from "redux"; | |
import Ratings from "./ratings/RatingsReducer"; | |
// Combine all reducers into one root reducer | |
export const RootReducer = combineReducers({ | |
Ratings | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { connect } from "react-redux"; | |
import React, { Component } from "react"; | |
import PropTypes from "prop-types"; | |
// Import Components | |
import RatingList from "./components/RatingList/RatingList"; | |
// Import Actions | |
import { fetchRatings } from "./RatingsActions"; | |
// import Reducer | |
import { getRatings } from "./RatingsReducer"; | |
class RatingsPage extends Component { |