Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4379 Rev 4380
Línea 9... Línea 9...
9
import SwitchInput from "./switch-input/SwitchInput";
9
import SwitchInput from "./switch-input/SwitchInput";
10
import Spinner from "../../../shared/loading-spinner/Spinner";
10
import Spinner from "../../../shared/loading-spinner/Spinner";
Línea 11... Línea 11...
11
 
11
 
12
const PRIVACY_OPTIONS = [
12
const PRIVACY_OPTIONS = [
13
  {
13
  {
14
    label: '',
14
    label: 'Mostrar en la búsqueda',
15
    input_name: '',
15
    input_name: 'show_in_search',
16
    value: false
16
    value: false
17
  }
17
  }
Línea 18... Línea 18...
18
]
18
]
Línea 45... Línea 45...
45
        addNotification({ style: "success", msg: response.data })
45
        addNotification({ style: "success", msg: response.data })
46
      })
46
      })
47
      .finally(() => setLoading(false))
47
      .finally(() => setLoading(false))
48
  };
48
  };
Línea -... Línea 49...
-
 
49
 
-
 
50
  const handleChecked = (value, element) => {
-
 
51
    setOptions((prevNotifications) => prevNotifications
-
 
52
      .map((notification) =>
-
 
53
        notification.input_name === element
-
 
54
          ? { ...notification, value: Boolean(value) }
-
 
55
          : notification
-
 
56
      ))
-
 
57
  }
49
 
58
 
50
  useEffect(() => {
59
  useEffect(() => {
51
    setLoading(true)
60
    setLoading(true)
52
    axios
61
    axios
53
      .get("/account-settings/privacy")
62
      .get("/account-settings/privacy")
Línea 68... Línea 77...
68
 
77
 
Línea 69... Línea 78...
69
  }, []);
78
  }, []);
70
 
79
 
71
  return (
80
  return (
72
    <div className="acc-setting">
81
    <div className="acc-setting">
-
 
82
      <h3>Privacidad</h3>
-
 
83
      <form onSubmit={handleSubmit(handleOnSubmit)}>
73
      <h3>Notificaciones</h3>
84
        {options.map((option, index) => {
-
 
85
          return (
74
      <form onSubmit={handleSubmit(handleOnSubmit)}>
86
            <div className="notbat" key={index}>
-
 
87
              <span>
75
        <div className="notbat">
88
                {option.label}
-
 
89
              </span>
-
 
90
              <SwitchInput
-
 
91
                isChecked={option.value}
76
          Mostrar en la búsqueda
92
                setValue={(value) => handleChecked(value, option.input_name)}
-
 
93
              />
-
 
94
            </div>
77
          <SwitchInput />
95
          )
78
        </div>
96
        })}
79
        <button type="submit" className="btn btn-primary">
97
        <button type="submit" className="btn btn-primary">
80
          Guardar
98
          Guardar
81
        </button>
99
        </button>