mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
redux fixes
This commit is contained in:
parent
873fd22cfb
commit
9f8603de31
3 changed files with 8 additions and 9 deletions
|
@ -186,7 +186,6 @@ module.exports = {
|
|||
},
|
||||
oauth: require("./oauth")(submoduleArgs),
|
||||
user: require("./user")(submoduleArgs),
|
||||
admin: require("./admin")(submoduleArgs),
|
||||
apiCall,
|
||||
convertToForm,
|
||||
getChanges
|
||||
|
|
|
@ -24,7 +24,6 @@ const { OAUTHError, AuthenticationError } = require("../errors");
|
|||
|
||||
const oauth = require("../../redux/reducers/oauth").actions;
|
||||
const temporary = require("../../redux/reducers/temporary").actions;
|
||||
const admin = require("../../redux/reducers/admin").actions;
|
||||
|
||||
module.exports = function oauthAPI({ apiCall, getCurrentUrl }) {
|
||||
return {
|
||||
|
@ -105,11 +104,8 @@ module.exports = function oauthAPI({ apiCall, getCurrentUrl }) {
|
|||
// no role info, try fetching an admin-only route and see if we get an error
|
||||
return Promise.try(() => {
|
||||
return dispatch(apiCall("GET", "/api/v1/admin/domain_blocks"));
|
||||
}).then((data) => {
|
||||
return Promise.all([
|
||||
dispatch(oauth.setAdmin(true)),
|
||||
dispatch(admin.setBlockedInstances(data))
|
||||
]);
|
||||
}).then(() => {
|
||||
return dispatch(oauth.setAdmin(true));
|
||||
}).catch(AuthenticationError, () => {
|
||||
return dispatch(oauth.setAdmin(false));
|
||||
});
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
const {
|
||||
replaceCacheOnMutation,
|
||||
appendCacheOnMutation,
|
||||
removeFromCacheOnMutation,
|
||||
domainListToObject
|
||||
} = require("../lib");
|
||||
|
@ -60,7 +59,12 @@ const endpoints = (build) => ({
|
|||
body: formData,
|
||||
discardEmpty: true
|
||||
}),
|
||||
...appendCacheOnMutation("instanceBlocks")
|
||||
transformResponse: (data) => {
|
||||
return {
|
||||
[data.domain]: data
|
||||
};
|
||||
},
|
||||
...replaceCacheOnMutation("instanceBlocks")
|
||||
}),
|
||||
removeInstanceBlock: build.mutation({
|
||||
query: (id) => ({
|
||||
|
|
Loading…
Reference in a new issue