mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Fix request duplication
This commit is contained in:
parent
30272b0c0c
commit
55ecd5581b
@ -31,7 +31,7 @@ class RequestActionsDropdown extends Component {
|
|||||||
</button>
|
</button>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<button onClick={e => db.requestCopy(request)}>
|
<button onClick={e => db.requestDuplicate(request)}>
|
||||||
<i className="fa fa-copy"></i> Duplicate
|
<i className="fa fa-copy"></i> Duplicate
|
||||||
<DropdownHint char="D"></DropdownHint>
|
<DropdownHint char="D"></DropdownHint>
|
||||||
</button>
|
</button>
|
||||||
|
@ -334,7 +334,7 @@ export function requestCreateAndActivate (workspace, patch = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function requestCopyAndActivate (workspace, request) {
|
export function requestCopyAndActivate (workspace, request) {
|
||||||
return requestCopy(request).then(r => {
|
return requestDuplicate(request).then(r => {
|
||||||
workspaceUpdate(workspace, {metaActiveRequestId: r._id});
|
workspaceUpdate(workspace, {metaActiveRequestId: r._id});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -377,9 +377,14 @@ export function requestUpdateContentType (request, contentType) {
|
|||||||
return docUpdate(request, {headers});
|
return docUpdate(request, {headers});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function requestCopy (request) {
|
export function requestDuplicate (request) {
|
||||||
const name = `${request.name} (Copy)`;
|
const name = `${request.name} (Copy)`;
|
||||||
return requestCreate(Object.assign({}, request, {name}));
|
const newRequest = Object.assign({}, request, {name});
|
||||||
|
|
||||||
|
// Remove the old Id
|
||||||
|
delete newRequest._id;
|
||||||
|
|
||||||
|
return requestCreate(newRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function requestRemove (request) {
|
export function requestRemove (request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user