-
Notifications
You must be signed in to change notification settings - Fork 618
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
Parse GET from Classes by ID Not Working inside Actions #168
Comments
Inside Parse.js this is what my code looks like
|
From here: http://parseplatform.github.io/docs/rest/guide/#objects it looks like the URL should be |
well the endpoint is actually... '/classes/Hosts/'+hostId (correct & tested) I'm just trying to get data other than the user profile and having a hard time as I'm coming from using sub/unsub/etc so this structure makes no sense to me since my GET call doesn't seem to work either. Is there no guide or example of using Parse in snowflake as far as data? |
All of Parse calls are in that Parse.js but there should be examples in On Thu, Nov 17, 2016 at 3:42 PM, iSamuelBarney notifications@github.com
|
I've modified everything a bit with but now I only get a promise back not the data... hmm |
But no more errors... |
looking @ reducers maybe thats what I'm needing... |
Maybe @wookiem can help, I really haven't done any development w/ the Parse On Thu, Nov 17, 2016 at 3:53 PM, iSamuelBarney notifications@github.com
|
Well I'll keep tinkering & hope @wookiem has time to help. Should figure this out hopefully soon lol |
I use the JavaScript API for the main part of my application and it's very straightforward. |
could you expand on that a bit? |
do you just use the session token to call from inside the component that renders then & import parse/react-native? |
Do you have any example code you can share? |
@wookiem I get a promise object back with no data when I use the actions/reducers which might be done wrong and probably is. There has to be a simple way to just grab the data once logged in as that's working fine, just can't get anything else. |
nvm @wookiem & @bartonhammond so sorry the issue was with setting the REST key & not a JS key...lol lesson learned |
Good for you. It happens to all of us, i was looking for my glasses everywhere this On Nov 17, 2016 5:43 PM, "iSamuelBarney" notifications@github.com wrote:
|
I am using a more recent version of Parse in package.json:
I initialize Parse within src/snowflake.js:
I keep track of the currently logged in user and the sessionToken in a separate Redux state called "currentUser". Here's its reducer (note how it ties in with existing snowflake redux states). [Edited based on Barton's comment below]
Then, here's sample code for saving data to Parse. A query example, follows the same pattern. Note, "store" refers to the redux store.
And here's a sample react-native component that would make the call to parseSaveCurrentProject:
|
Looks to me that some of those case blocks could be merged as they are On Nov 17, 2016 7:07 PM, "wookiem" notifications@github.com wrote:
|
Yeah, that's a good point! |
@wookiem do you have an example of a query? I'm just getting some issues when trying to use the Parse.js file here is my code:
Not sure what I'm doing wrong here |
@wookiem getting Error: Permission denied for action get on class Hosts. |
The error suggests that Parse class instance hasn't been initialized properly. When you put a breakpoint on the If not, then you'll need to add Then you should be able to initiate the promise chain with the following:
|
Got it working!!!! Thanks all I had to do was add the global.currentUser with the token as an argument just like you suggested. Thanks!! |
Thanks for all the help @wookiem one more quick question lol. How would I add relation query constraints like:
it shows in curl curl -X GET ... How do i add --data-urlencode into my request?
|
I'm not sure. After logging in, I switch gears and use the Parse Javascript API for all of my Parse database interactions (i.e. I don't try to use the REST API). I show how to make this switch in my sample code from a couple weeks ago (see above). I find it a lot more intuitive than using the REST API... |
Yea seems like I should do the same then. |
I got it working!! FYI if you wanted to see how below. import qs from 'querystring' |
Good job @iSamuelBarney |
YellowBox.js:69 Possible Unhandled Promise Rejection (id: 0): Cannot read property 'getScrollableNode' of undefined TypeError: Cannot read property 'getScrollableNode' of undefined at AnimatedComponent._detachNativeEvents (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:54506:24) at AnimatedComponent.componentWillUnmount (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:54467:6) at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:23355:13 at measureLifeCyclePerf (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:23021:8) at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:23354:1) at Object.unmountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:21620:18) at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:23364:17) at Object.unmountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:21620:18) at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:23364:17) at Object.unmountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false&hot=true:21620:18)console.warn @ YellowBox.js:69onUnhandled @ Promise.js:25onUnhandled @ rejection-tracking.js:71(anonymous function) @ JSTimers.js:78callTimer @ JSTimersExecution.js:99callTimers @ JSTimersExecution.js:140__callFunction @ MessageQueue.js:234(anonymous function) @ MessageQueue.js:105guard @ MessageQueue.js:45callFunctionReturnFlushedQueue @ MessageQueue.js:104onmessage @ debuggerWorker.js:44
What am I doing wrong? I'm trying to use GET from /classes//
Where should I be making these calls or how as no examples are included anywhere so I'm just spinning my wheels keep getting this error.
The text was updated successfully, but these errors were encountered: