mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-28 19:03:15 +01:00
chore: focus newly added request tab
This commit is contained in:
parent
233a078b73
commit
d1b785c909
@ -79,7 +79,6 @@ const reducer = (state, action) => {
|
|||||||
|
|
||||||
if(draft.requestTabs && draft.requestTabs.length) {
|
if(draft.requestTabs && draft.requestTabs.length) {
|
||||||
draft.activeRequestTabId = draft.requestTabs[0].id;
|
draft.activeRequestTabId = draft.requestTabs[0].id;
|
||||||
console.log(draft.activeRequestTabId);
|
|
||||||
} else {
|
} else {
|
||||||
draft.activeRequestTabId = null;
|
draft.activeRequestTabId = null;
|
||||||
}
|
}
|
||||||
@ -89,18 +88,14 @@ const reducer = (state, action) => {
|
|||||||
case actions.ADD_REQUEST: {
|
case actions.ADD_REQUEST: {
|
||||||
return produce(state, (draft) => {
|
return produce(state, (draft) => {
|
||||||
const collection = find(draft.collections, (c) => c.id === action.collectionId);
|
const collection = find(draft.collections, (c) => c.id === action.collectionId);
|
||||||
console.log('a');
|
|
||||||
|
|
||||||
if(collection) {
|
if(collection) {
|
||||||
let flattenedItems = flattenItems(collection.items);
|
let flattenedItems = flattenItems(collection.items);
|
||||||
let item = findItem(flattenedItems, action.itemId);
|
let item = findItem(flattenedItems, action.itemId);
|
||||||
console.log('b');
|
|
||||||
|
|
||||||
if(item) {
|
if(item) {
|
||||||
console.log('c');
|
|
||||||
if(!isItemARequest(item)) {
|
if(!isItemARequest(item)) {
|
||||||
console.log('d');
|
let newRequest = {
|
||||||
item.items.push({
|
|
||||||
"id": nanoid(),
|
"id": nanoid(),
|
||||||
"depth": 2,
|
"depth": 2,
|
||||||
"name": "Capsules 2",
|
"name": "Capsules 2",
|
||||||
@ -117,6 +112,14 @@ const reducer = (state, action) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": null
|
"response": null
|
||||||
|
};
|
||||||
|
draft.activeRequestTabId = newRequest.id;
|
||||||
|
item.items.push(newRequest);
|
||||||
|
draft.requestTabs.push({
|
||||||
|
id: newRequest.id,
|
||||||
|
name: newRequest.name,
|
||||||
|
method: newRequest.request.method,
|
||||||
|
collectionId: collection.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user