Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow responses w/o data envelope. workaround for #6 until #19 is done #22

Merged
merged 4 commits into from
Aug 4, 2016

Conversation

devvmh
Copy link
Owner

@devvmh devvmh commented Jul 20, 2016

grep -r 'action.payload.data' src/ returns only these two lines now, so I believe this should cover people who have responses without a data envelope. I need someone to test this though before I feel happy merging it in. @mxmtsk would you be interested in trying this branch out with your project? I could merge this as 4.3.0 this week if it works for you.

@mxmtsk
Copy link

mxmtsk commented Jul 20, 2016

could you help me with how to build the new files in lib/ from your changes in src/? 😅

@devvmh
Copy link
Owner Author

devvmh commented Jul 20, 2016

I think the simplest way is to clone this repo to your localhost, and then run npm install and npm run build

Then you can change your project's package.json to say

"redux-crud-store": "/local/path/to/redux-crud-store",

Does that make sense?

@mxmtsk
Copy link

mxmtsk commented Jul 20, 2016

Got it to work. It works fine without a data envelope, but with the data envelope I had in before for testing purposes it throws

TypeError: originalPayload.delete is not a function

@devvmh
Copy link
Owner Author

devvmh commented Jul 20, 2016

Ah ha, excellent, thanks, that latest commit should fix that

@mxmtsk
Copy link

mxmtsk commented Jul 20, 2016

now it throws the error at TypeError: otherInfo.delete is not a function

@devvmh
Copy link
Owner Author

devvmh commented Jul 20, 2016

d'oh

@mxmtsk
Copy link

mxmtsk commented Jul 20, 2016

we're getting there...
.delete is not defined still but I changed it to

if ('data' in originalPayload) delete otherInfo.data;

Which works but results in the new error

[1]    TypeError: payload.forEach is not a function
[1]        at /Users/maxmitschke/work/wtc-web/node_modules/redux-crud-store/lib/reducers.js:74:17

@devvmh
Copy link
Owner Author

devvmh commented Jul 20, 2016

😢 I'll try again tomorrow morning. This file is weird. I don't know why there are two case FETCH_SUCCESS: lines

@devvmh devvmh force-pushed the feature/no-data-dependence branch from 1be89ac to 6570f41 Compare July 21, 2016 03:30
@devvmh
Copy link
Owner Author

devvmh commented Jul 21, 2016

I think that's yet another response format function that won't be solved
without enabling normalizr.

Are you able to change your ApiClient to ensure that the response data is
an array no matter what?

On Wed, Jul 20, 2016 at 6:55 PM Max Mitschke [email protected]
wrote:

we're getting there...
.delete is not defined still but I changed it to

if ('data' in originalPayload) delete otherInfo.data;

Which works but results in the new error

[1] TypeError: payload.forEach is not a function
[1] at /Users/maxmitschke/work/wtc-web/node_modules/redux-crud-store/lib/reducers.js:74:17


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABVELDaiptWEW5dpO6LuvRon5BJacs7cks5qXf6XgaJpZM4JQYld
.

@devvmh devvmh force-pushed the feature/no-data-dependence branch from 6570f41 to cea5966 Compare July 27, 2016 02:27
@devvmh devvmh merged commit 3f63424 into master Aug 4, 2016
@devvmh devvmh deleted the feature/no-data-dependence branch August 4, 2016 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants