patreon. How to get list of creators and count of their patrons - patreon

Maybe, somebody have any suggestions, how to get list of creators then get count of patrons in each creator (and if available also get sum)

Here you have the official Patreon API documentation where you can find all of that

Related

Chain redux store update

I would like to dispatch an action after a first one has been processed by the reducers.
Here is my use case. My component allows the user to select a list of notes (this list is store in redux). Based on some user actions, a random note can be selected from this list and saved in the store.
In the screenshot you can see buttons. "Select All" and "Unselect All" act on the list of possible note. "Start" pick a note from the list.
The issue I have concern the "reset button". It is supposed to chain "select all" and "start" and I don't know how to do that. I tried a naive:
const reset = function () {
dispatch(selectAll());
dispatch(pickANote());
}
With this example, I am facing what I think is a data race. The second action pick a note from a note updated list.
Digging the internet, I found only cases of action chaining based on API calls with redux thunk. The problem I have is that I don't know how to trigger something when a action is processed (which is obvious with an API call)
So, there is 3 solutions:
I am missing something obvious
I am going where no man has gone before
I am doing something anti-pattern
Any help is welcome.
Alright, I found my answer.
No surprise, I was thinking anti-pattern.
In the redux style guide, there is 2 points that lead me to the solution.
It is strongly recommended to dispatch one action that is processed
by several reducers.
It is strongly recommended to put the logic inside the reducers.
The consequence is that I should dispatch "raw data" and then compute value reducers. Following this path, I am not dependent on the values already in the store for the next updates and so, I do not face any data race.

How to use 2 identicals action calls with different params on the same page with Redux?

I need your help, I've been looking for a solution for a while and haven't been able to find something. I'm doing a React website with Redux and I have my components, my containers, actions, reducers etc. And sometimes I need to use two identical containers on the same page but with different params.
<TeamContainer teamID='123'/>
<TeamContainer teamID='456'/>
And each container dispatches the same action "Fetch Team Data" with the teamID. So Redux first asks for team data for team 123 and then for team 456 but when it comes to reduce data, the second call "erases" the first one. I know it's normal and usefull to update data but in this case I don't know how to avoid it properly.
How am I supposed to do ? Any tip ?
Thanks :)
my tip:
try store data in arrays, there is not overwrited.
https://hackernoon.com/redux-patterns-add-edit-remove-objects-in-an-array-6ee70cab2456

Get the groups of the device in Graph

I need to get the group membership of the device in AAD.
It is possible to get the groups, select one, get members and find a device there in one call
https://graph.microsoft.com/v1.0/groups/xxx/members/yyy
I can get to the same device as by calling
https://graph.microsoft.com/v1.0/me/registeredDevices/yyy
But I haven’t found anything for a reversed approach for the device. It is simple to find the group membership of a user
https://graph.microsoft.com/v1.0/me/memberOf
but this apparently doesn’t seem to be possible for the device. Neither in v1.0, nor in beta.
Am I missing something? Thanks!
If I understand, you are looking for something that will tell you what groups a device is a member of like:
GET https://graph.microsoft.com/v1.0/devices/memberOf
We don't have anything like that today.
However we do have an alternative, that might work for you, and it provides transitive closure too (which memberOf does not). See: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/directoryobject_getmembergroups
POST https://graph.microsoft.com/v1.0/devices/{deviceId}/getMemberGroups
{
"securityEnabledOnly":false
}
The response will contain a list of group ids for which the device is a member. To get the group details, you will have to make another call. You could use the getByIds action for this - see https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/directoryobject_getbyids. If you want to do this in one call, you could take a look at using batching: https://developer.microsoft.com/en-us/graph/docs/concepts/json_batching.
Hope this helps,

Best approach to use nested reducer in React-Redux If same store value are used on same page

I am using same filter two time same screen for different purpose. Now updating at one place automatically updates the dependent values on second filter as well.
You are going to need two states in your Redux store - one for each filter. Then you need to connect one state to one filter, and the other state to the other filter.
You don't need to duplicate your reducers and actions though. Your action could take an filterId as input, and then pass this down to the reducer. The reducer updates different states based on which filterId is passed in from the action.
Hope that makes sense! Feel free to add follow up questions or additional information about your problem to get a more detailed explanation!

Problems with architecture of the redux store

I'm developing an application that has several states (reducers). Let's say they are messages, likes, comments (all of them are from the completely different instances so i'm not sure if i should combine them into one state).
Every 30 seconds i make request to the server and i receive response that says which parts of my application have been updated. E.g. i received new messages or new comment.
I don't really know how to handle those responses. First, i can simply let container update all other states, but i don't think that it's a good idea, because every container should have it's own state.
Second, i can create a middleware that will catch every action, find the one with required information and shot another action (e.g. new message). After that reducer of the messages will catch this action. But i'm not sure again if this is a correct approach for two reasons:
Is it okay to shot actions from the middleware (won't it be a bidirectional flow)?
How can i actually do it?
Thanks in advance.
UPD. I did it using middleware, but i'm still not sure if this is a correct way. In my middleware i obtain required data using store.getState()... and then i make store.dispatch(myAction). Is it okay?
It's important to understand that a reducer /= state. ( reducer not equal state )
You should have one state, one store for your application. Use combineReducers to well.. combine reducers to keep everything in one state.
http://redux.js.org/docs/api/combineReducers.html
You need to handle async behaviour, something which is not default by redux and therefore you have to use some kind of middleware - meaning you were on the right track.
Try and use the more common once like:
https://github.com/gaearon/redux-thunk
https://github.com/redux-saga/redux-saga
It's advised to separate the async logic from your app. Meaning you need to init your async calling in the app, but keep the async logic in the store.
Here's a guide by Dan Abramov and Redux-Thunk which is simple and clear:
http://redux.js.org/docs/advanced/AsyncActions.html
Hope it answers you.

Resources