mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Better interface for creating custom formats
This commit is contained in:
5
frontend/src/Utilities/State/getNextId.js
Normal file
5
frontend/src/Utilities/State/getNextId.js
Normal file
@@ -0,0 +1,5 @@
|
||||
function getNextId(items) {
|
||||
return items.reduce((id, x) => Math.max(id, x.id), 1) + 1;
|
||||
}
|
||||
|
||||
export default getNextId;
|
@@ -1,7 +1,7 @@
|
||||
import _ from 'lodash';
|
||||
import getSectionState from 'Utilities/State/getSectionState';
|
||||
|
||||
function getProviderState(payload, getState, section) {
|
||||
function getProviderState(payload, getState, section, keyValueOnly=true) {
|
||||
const {
|
||||
id,
|
||||
...otherPayload
|
||||
@@ -23,10 +23,17 @@ function getProviderState(payload, getState, section) {
|
||||
field.value;
|
||||
|
||||
// Only send the name and value to the server
|
||||
result.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
if (keyValueOnly) {
|
||||
result.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
} else {
|
||||
result.push({
|
||||
...field,
|
||||
value
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
Reference in New Issue
Block a user