Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3371 | Rev 3697 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3371 Rev 3373
Línea 84... Línea 84...
84
  const nextStep = async () => {
84
  const nextStep = async () => {
85
    const valid = await trigger()
85
    const valid = await trigger()
86
    if (valid) setCurrentTab(currentTab + 1)
86
    if (valid) setCurrentTab(currentTab + 1)
87
  }
87
  }
Línea 88... Línea 88...
88
 
88
 
89
  const dataAdapter = ({
-
 
90
    monday_active,
-
 
91
    tuesday_active,
-
 
92
    wednesday_active,
-
 
93
    thursday_active,
-
 
94
    friday_active,
-
 
95
    saturday_active,
-
 
96
    sunday_active,
-
 
97
    notification_10min_before,
-
 
98
    notification_30min_before,
-
 
99
    ...habit
-
 
100
  }) => {
-
 
101
    onSubmit({
-
 
102
      monday_active: monday_active ? 1 : 0,
-
 
103
      tuesday_active: tuesday_active ? 1 : 0,
-
 
104
      wednesday_active: wednesday_active ? 1 : 0,
-
 
105
      thursday_active: thursday_active ? 1 : 0,
89
  const formatHabit = (habit) => {
106
      friday_active: friday_active ? 1 : 0,
90
    const dataArray = Object.entries(habit)
107
      saturday_active: saturday_active ? 1 : 0,
91
    const formatedData = dataArray.map(([key, value]) => {
108
      sunday_active: sunday_active ? 1 : 0,
-
 
109
      notification_10min_before: notification_10min_before ? 1 : 0,
92
      if (key.includes('active')) return [key, value ? 1 : 0]
110
      notification_30min_before: notification_30min_before ? 1 : 0,
93
      if (key.includes('time')) return [key, value.padEnd(8, ':00')]
111
      ...habit
94
      return [key, value]
-
 
95
    })
-
 
96
    return Object.fromEntries(formatedData)
-
 
97
  }
-
 
98
 
-
 
99
  const dataAdapter = (habit) => {
-
 
100
    const formatedHabit = formatHabit(habit)
112
    })
101
    onSubmit(formatedHabit)
Línea 113... Línea 102...
113
  }
102
  }
114
 
103
 
115
  return (
104
  return (