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),
|
oauth: require("./oauth")(submoduleArgs),
|
||||||
user: require("./user")(submoduleArgs),
|
user: require("./user")(submoduleArgs),
|
||||||
admin: require("./admin")(submoduleArgs),
|
|
||||||
apiCall,
|
apiCall,
|
||||||
convertToForm,
|
convertToForm,
|
||||||
getChanges
|
getChanges
|
||||||
|
|
|
@ -24,7 +24,6 @@ const { OAUTHError, AuthenticationError } = require("../errors");
|
||||||
|
|
||||||
const oauth = require("../../redux/reducers/oauth").actions;
|
const oauth = require("../../redux/reducers/oauth").actions;
|
||||||
const temporary = require("../../redux/reducers/temporary").actions;
|
const temporary = require("../../redux/reducers/temporary").actions;
|
||||||
const admin = require("../../redux/reducers/admin").actions;
|
|
||||||
|
|
||||||
module.exports = function oauthAPI({ apiCall, getCurrentUrl }) {
|
module.exports = function oauthAPI({ apiCall, getCurrentUrl }) {
|
||||||
return {
|
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
|
// no role info, try fetching an admin-only route and see if we get an error
|
||||||
return Promise.try(() => {
|
return Promise.try(() => {
|
||||||
return dispatch(apiCall("GET", "/api/v1/admin/domain_blocks"));
|
return dispatch(apiCall("GET", "/api/v1/admin/domain_blocks"));
|
||||||
}).then((data) => {
|
}).then(() => {
|
||||||
return Promise.all([
|
return dispatch(oauth.setAdmin(true));
|
||||||
dispatch(oauth.setAdmin(true)),
|
|
||||||
dispatch(admin.setBlockedInstances(data))
|
|
||||||
]);
|
|
||||||
}).catch(AuthenticationError, () => {
|
}).catch(AuthenticationError, () => {
|
||||||
return dispatch(oauth.setAdmin(false));
|
return dispatch(oauth.setAdmin(false));
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
const {
|
const {
|
||||||
replaceCacheOnMutation,
|
replaceCacheOnMutation,
|
||||||
appendCacheOnMutation,
|
|
||||||
removeFromCacheOnMutation,
|
removeFromCacheOnMutation,
|
||||||
domainListToObject
|
domainListToObject
|
||||||
} = require("../lib");
|
} = require("../lib");
|
||||||
|
@ -60,7 +59,12 @@ const endpoints = (build) => ({
|
||||||
body: formData,
|
body: formData,
|
||||||
discardEmpty: true
|
discardEmpty: true
|
||||||
}),
|
}),
|
||||||
...appendCacheOnMutation("instanceBlocks")
|
transformResponse: (data) => {
|
||||||
|
return {
|
||||||
|
[data.domain]: data
|
||||||
|
};
|
||||||
|
},
|
||||||
|
...replaceCacheOnMutation("instanceBlocks")
|
||||||
}),
|
}),
|
||||||
removeInstanceBlock: build.mutation({
|
removeInstanceBlock: build.mutation({
|
||||||
query: (id) => ({
|
query: (id) => ({
|
||||||
|
|
Loading…
Reference in a new issue