Giter Site home page Giter Site logo

fake-medium's Introduction

fake-medium's People

Contributors

ohansemmanuel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fake-medium's Issues

License File

Hi Ohansemmanuel

Nice work - this was very helpful to me.

It looks like you don't have a license file in this repo. Would you mind adding one? Without this, the code can not legally be used in other applications.

Thanks

onFailure displaying automatically in console

Hi, I just noted that in the function actions/index.js you have specified a onFailure function equal to console.log("Error occured loading articles") , I suppose what you meant there is an arrow function like this ? : () => { console.log("Error occured loading articles"); } So that IF there is an error that lambda function is called.
Really nice tutorial, it helped me a lot!
Best, Phil

Actions must be plain objects. Use custom middleware for async actions.

export function newProfile(data) {
    return new Promise((resolve) => (dispatch) => {
        apiAction({
            url: '/profile',
            data,
            onSuccess: ((response) => {
                dispatch({
                    type: NEWPROFILE,
                    payload: response.id
                });
                resolve(response.id);
            }),
            label: LOADING,
        });
  });
}

props.newProfile(data).then((id) => {
    // get id
});

¿How to solved?

question regarding axios requests

HI,
that data fetching with redux middleware is really good but I'm thinking what we should do when we don't want to pass request data into store every-time? For example I have small component which should store some data from api request in the state, I don't want to push everything into store. Do you have any idea how to manage this?

How to wait for promise object ?

Hi,

Your way of implementing a generic api middleware is great.

I am using 'UseDispatch' from react-redux library, here i will dispatch to an action and do an api call and update the redux store using reducer.

But my requirement is "need to wait till the redux store has data and then proceed further". Any idea how to get this ?

Can i make a specific api call from action method as async await when i call that action method from functional component or inside useEffect() i need to wait till i have data in redux store.

Regards,
Sandesh

Add another reducer

Hello,

Allow me to first give you a round of applause and a huge thanks, your middleware is quite perfect, very beautiful coding. Yet I failed to see on how I could use it while working with several reducers because as you work with the article_details reducer when adding another reducer and duplicating the code to hold another set of actions, my two reducers collide and having this error :

Given action "API_START", reducer "reducerOne" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.

=> both reducers hold the same case API_START when the middleware dispatch it on onSuccess(data)

My guess is that I would have to split the actions for the middleware to remain untouched and then try to keep the structure of the reducers as it is. What is your opinion ?

While thanking you again,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.