MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / formValuesToPayload

Function formValuesToPayload

frontend/src/utils/forms/UserUtils.js:65–106  ·  view source on GitHub ↗
(values, existingUser)

Source from the content-addressed store, hash-verified

63};
64
65export const formValuesToPayload = (values, existingUser) => {
66 const customProps = { ...(existingUser?.custom_properties || {}) };
67 const payload = { ...values };
68
69 customProps.xc_password = payload.xc_password || '';
70 delete payload.xc_password;
71
72 customProps.output_format = payload.output_format || null;
73 delete payload.output_format;
74
75 customProps.output_profile = payload.output_profile
76 ? parseInt(payload.output_profile, 10)
77 : null;
78 delete payload.output_profile;
79
80 customProps.hide_adult_content = payload.hide_adult_content || false;
81 delete payload.hide_adult_content;
82
83 customProps.epg_days = payload.epg_days || 0;
84 delete payload.epg_days;
85
86 customProps.epg_prev_days = payload.epg_prev_days || 0;
87 delete payload.epg_prev_days;
88
89 const joined = (payload.allowed_ips || []).join(',');
90 delete payload.allowed_ips;
91 const allowed_networks = {};
92 if (joined) {
93 NETWORK_KEYS.forEach((key) => {
94 allowed_networks[key] = joined;
95 });
96 }
97 customProps.allowed_networks = allowed_networks;
98
99 payload.custom_properties = customProps;
100
101 if (payload.channel_profiles?.includes('0')) {
102 payload.channel_profiles = [];
103 }
104
105 return payload;
106};
107
108export const getFormInitialValues = () => {
109 return {

Callers 2

onSubmitFunction · 0.90
UserUtils.test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected