Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 3184 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3184 Rev 3185
Línea 56... Línea 56...
56
  }, [settedPrivacy]);
56
  }, [settedPrivacy]);
Línea 57... Línea 57...
57
 
57
 
58
  const onSubmitHandler = async (data) => {
58
  const onSubmitHandler = async (data) => {
59
    // profile/my-profiles/extended', [ 'id' => $user_profile_id_encrypted]
59
    // profile/my-profiles/extended', [ 'id' => $user_profile_id_encrypted]
-
 
60
    // https://leaderslinked.com/profile/my-profiles/extended/MzU4NDg3ODcg
60
    // https://leaderslinked.com/profile/my-profiles/extended/MzU4NDg3ODcg
61
    setLoading(true);
61
    const formData = new FormData();
62
    const formData = new FormData();
62
    Object.entries(data).map(async ([key, value]) => {
-
 
63
      setLoading(true);
-
 
64
      if (value === 'pr') {
63
    Object.entries(data).map(([key, value]) => formData.append(key, value))
65
        const accessibilityData = new FormData()
64
    await axios.post(`/group/my-groups/privacy/${groupId}`, formData)
66
        accessibilityData.append('accessibility', 'aa')
-
 
67
        const { data } = await axios.post(`/group/my-groups/accessibility/${groupId}`, accessibilityData)
65
      .then(async ({ data }) => {
68
        if (data.success) {
66
        if (data.success) {
69
          setSettedAccesibility(data.data)
67
          setSettedPrivacy(data.data);
70
          setLoading(false)
68
          handleModalOpen();
71
        }
-
 
72
 
69
          if (data.data === 'Privado') {
73
        setLoading(false)
-
 
74
      }
70
            const accessibilityData = new FormData()
-
 
71
            accessibilityData.append('accessibility', 'aa')
-
 
72
            const { data } = await axios.post(`/group/my-groups/accessibility/${groupId}`, accessibilityData)
75
      formData.append(key, value)
73
            data.success && setSettedAccesibility(data.data)
76
    })
-
 
77
 
74
          }
78
    if (!loading) {
75
        } else {
79
      setLoading(true)
76
          const resError = data.data;
80
      await axios.post(`/group/my-groups/privacy/${groupId}`, formData)
77
          if (resError.constructor.name === "Object") {
81
        .then((response) => {
78
            Object.entries(resError).map(([key, value]) => {
82
          const resData = response.data;
79
              if (key in getValues()) {
83
          (resData);
80
                setError(key, {
84
          if (resData.success) {
81
                  type: "manual",
85
            setSettedPrivacy(resData.data);
82
                  message: Array.isArray(value) ? value[0] : value,
-
 
83
                });
-
 
84
              }
86
            handleModalOpen();
85
            });
87
          } else {
-
 
88
            const resError = resData.data;
-
 
89
            if (resError.constructor.name === "Object") {
-
 
90
              Object.entries(resError).map(([key, value]) => {
-
 
91
                if (key in getValues()) {
-
 
92
                  setError(key, {
-
 
93
                    type: "manual",
-
 
94
                    message: Array.isArray(value) ? value[0] : value,
-
 
95
                  });
-
 
96
                }
-
 
97
              });
-
 
98
            } else {
86
          } else {
99
              addNotification({
87
            addNotification({
100
                style: "danger",
88
              style: "danger",
101
                msg: resError,
89
              msg: resError,
102
              });
-
 
103
            }
90
            });
104
          }
91
          }
105
        });
92
        }
106
    }
93
      });
107
    setLoading(false);
94
    setLoading(false);
Línea 108... Línea 95...
108
  };
95
  };
109
 
96