mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-05 01:52:46 +00:00
redux fixes
This commit is contained in:
parent
873fd22cfb
commit
9f8603de31
|
@ -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