Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7214 Rev 7216
Línea 7... Línea 7...
7
import QuestionCard from '../../components/my-coach/QuestionCard'
7
import QuestionCard from '../../components/my-coach/QuestionCard'
8
import ConfirmModal from '../../components/modals/ConfirmModal'
8
import ConfirmModal from '../../components/modals/ConfirmModal'
Línea 9... Línea 9...
9
 
9
 
10
const MyCoachViewPage = () => {
10
const MyCoachViewPage = () => {
-
 
11
  const [question, setQuestion] = useState({})
11
  const [question, setQuestion] = useState({})
12
  const [answers, setAnswers] = useState([])
12
  const [modalShow, setModalShow] = useState(null)
13
  const [modalShow, setModalShow] = useState(null)
13
  const addUrl = useRef('')
14
  const addUrl = useRef('')
14
  const actionUrl = useRef('')
15
  const actionUrl = useRef('')
15
  const labels = useSelector(({ intl }) => intl.labels)
16
  const labels = useSelector(({ intl }) => intl.labels)
Línea 99... Línea 100...
99
 
100
 
100
  useEffect(() => {
101
  useEffect(() => {
101
    getQuestion()
102
    getQuestion()
Línea -... Línea 103...
-
 
103
  }, [])
-
 
104
 
-
 
105
  useEffect(() => {
-
 
106
    if (question.link_answers) {
-
 
107
      axios
-
 
108
        .get(question.link_answers)
-
 
109
        .then((response) => {
-
 
110
          const { data, success } = response.data
-
 
111
 
-
 
112
          if (!success) {
-
 
113
            const errorMessage =
-
 
114
              typeof data === 'string'
-
 
115
                ? data
-
 
116
                : 'Error interno. Por favor, inténtelo de nuevo más tarde.'
-
 
117
 
-
 
118
            dispatch(addNotification({ style: 'danger', msg: errorMessage }))
-
 
119
            return
-
 
120
          }
-
 
121
 
-
 
122
          setAnswers(data)
-
 
123
        })
-
 
124
        .catch((error) => {
-
 
125
          dispatch(
-
 
126
            addNotification({
-
 
127
              style: 'danger',
-
 
128
              msg: 'Error interno. Por favor, inténtelo de nuevo más tarde.',
-
 
129
            })
-
 
130
          )
-
 
131
          throw new Error(error)
-
 
132
        })
-
 
133
    }
102
  }, [])
134
  }, [question])
103
 
135
 
104
  return (
136
  return (
105
    <>
137
    <>
106
      <Container as="section" className="companies-info">
138
      <Container as="section" className="companies-info">