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

Function prepareSubmitValues

frontend/src/utils/forms/M3uUtils.js:26–58  ·  view source on GitHub ↗
(values, expDate)

Source from the content-addressed store, hash-verified

24};
25
26export const prepareSubmitValues = (values, expDate) => {
27 const prepared = { ...values };
28
29 if (prepared.account_type === 'XC') {
30 delete prepared.exp_date;
31 } else if (expDate instanceof Date) {
32 prepared.exp_date = expDate.toISOString();
33 } else {
34 prepared.exp_date = null;
35 }
36
37 const hasCron =
38 prepared.cron_expression && prepared.cron_expression.trim() !== '';
39 if (hasCron) {
40 prepared.refresh_interval = 0;
41 } else {
42 prepared.cron_expression = '';
43 }
44
45 if (prepared.account_type == 'XC' && prepared.password == '') {
46 delete prepared.password;
47 }
48
49 if (prepared.user_agent == '0') {
50 prepared.user_agent = null;
51 }
52
53 if (prepared.server_group == '0') {
54 prepared.server_group = null;
55 }
56
57 return prepared;
58};

Callers 2

onSubmitFunction · 0.90
M3uUtils.test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected