Better request creation (Closes #14)

This commit is contained in:
Gregory Schier
2024-01-15 21:39:27 -08:00
parent 9658434503
commit dc552b8099
2 changed files with 14 additions and 6 deletions

View File

@@ -24,7 +24,15 @@ export function useCreateRequest() {
if (workspaceId === null) {
throw new Error("Cannot create request when there's no active workspace");
}
patch.sortPriority = patch.sortPriority || -Date.now();
if (patch.sortPriority === undefined) {
if (activeRequest != null) {
// Place above currently-active request
patch.sortPriority = activeRequest.sortPriority + 0.0001;
} else {
// Place at the very top
patch.sortPriority = -Date.now();
}
}
patch.folderId = patch.folderId || activeRequest?.folderId;
return invoke('create_request', { workspaceId, name: '', ...patch });
},