mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-02 17:08:32 +00:00
feat: moved up the state logic for graphql query change
This commit is contained in:
@@ -3,6 +3,7 @@ const SIDEBAR_COLLECTION_ITEM_CLICK = "SIDEBAR_COLLECTION_ITEM_CLICK";
|
||||
const REQUEST_TAB_CLICK = "REQUEST_TAB_CLICK";
|
||||
const REQUEST_TAB_CLOSE = "REQUEST_TAB_CLOSE";
|
||||
const REQUEST_URL_CHANGED = "REQUEST_URL_CHANGED";
|
||||
const REQUEST_GQL_QUERY_CHANGED = "REQUEST_GQL_QUERY_CHANGED";
|
||||
const RESPONSE_RECEIVED = "RESPONSE_RECEIVED";
|
||||
const SEND_REQUEST = "SEND_REQUEST";
|
||||
const SENDING_REQUEST = "SENDING_REQUEST";
|
||||
@@ -16,6 +17,7 @@ export default {
|
||||
REQUEST_TAB_CLICK,
|
||||
REQUEST_TAB_CLOSE,
|
||||
REQUEST_URL_CHANGED,
|
||||
REQUEST_GQL_QUERY_CHANGED,
|
||||
RESPONSE_RECEIVED,
|
||||
SEND_REQUEST,
|
||||
SENDING_REQUEST,
|
||||
|
||||
@@ -73,6 +73,21 @@ const reducer = (state, action) => {
|
||||
});
|
||||
}
|
||||
|
||||
case actions.REQUEST_GQL_QUERY_CHANGED: {
|
||||
return produce(state, (draft) => {
|
||||
const collection = find(draft.collections, (c) => c.id === action.collectionId);
|
||||
|
||||
if(collection) {
|
||||
let flattenedItems = flattenItems(collection.items);
|
||||
let item = findItem(flattenedItems, action.requestTab.id);
|
||||
|
||||
if(item) {
|
||||
item.request.body.graphql.query = action.query;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
case actions.ADD_NEW_HTTP_REQUEST: {
|
||||
return produce(state, (draft) => {
|
||||
const uid = nanoid();
|
||||
|
||||
Reference in New Issue
Block a user