You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it is not friendly to other middleware.
consider about this case.
I try to storage the response data after user click login.
here's a middleware
export const storageMiddleware = store => next => action => {
switch (action.type) {
case USER_ACTION.LOGIN: filterPack(action, () => storage(STORAGE_KEY.USER, action)); break;
case USER_ACTION.LOGOUT: clear(STORAGE_KEY.USER); break;
default: ;
}
return next(action)
}
It is confuse about filterPack
we get 2 actions which type = LOGIN but actually different.
so I have to write these code to judge request success or not.
export const filterPack = (action, callback, status = LIFECYCLE.SUCCESS) => {
const { meta } = action;
const lifecycle = meta ? meta[KEY.LIFECYCLE] : null;
if (lifecycle === status) {
return callback(meta);
}
return action;
}
It should be part of this repo and It seems like how your handle works in reducer.
So i guess you miss something here.
In fact, i hope it will be auto splited into ${action.type}_${lifecycle.toUpperCase()} and config it in createMiddleware
(thanks for reading :> )
The text was updated successfully, but these errors were encountered:
about this code:
I think it is not friendly to other middleware.
consider about this case.
I try to storage the response data after user click login.
here's a middleware
It is confuse about
filterPack
we get 2 actions which
type = LOGIN
but actually different.so I have to write these code to judge request success or not.
It should be part of this repo and It seems like how your
handle
works in reducer.So i guess you miss something here.
In fact, i hope it will be auto splited into
${action.type}_${lifecycle.toUpperCase()}
and config it in createMiddleware(thanks for reading :> )
The text was updated successfully, but these errors were encountered: