mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-25 22:59:10 -04:00
New: Better interface for creating custom formats
This commit is contained in:
@@ -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