Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3156 Rev 3407
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react'
2
import { connect } from 'react-redux'
2
import { connect } from 'react-redux'
3
import { Link } from 'react-router-dom'
3
import { Link } from 'react-router-dom'
Línea 4... Línea 4...
4
 
4
 
-
 
5
import { axios } from '@app/utils'
5
import { axios } from '@app/utils'
6
import { asyncLogout } from '@store/auth/auth.actions'
Línea 6... Línea 7...
6
import { addNotification } from '@app/redux/notification/notification.actions'
7
import { addNotification } from '@app/redux/notification/notification.actions'
7
 
8
 
8
import Form from '@app/components/UI/form/Form'
9
import Form from '@app/components/UI/form/Form'
Línea 54... Línea 55...
54
    } finally {
55
    } finally {
55
      setLoading(false)
56
      setLoading(false)
56
    }
57
    }
57
  }
58
  }
Línea 58... Línea -...
58
 
-
 
59
  const logout = () => {
-
 
60
    window.location.href = '/signout'
-
 
61
  }
-
 
62
 
59
 
63
  const handleSubmit = async (e) => {
60
  const handleSubmit = async (e) => {
64
    try {
61
    try {
65
      e.preventDefault()
62
      e.preventDefault()
66
      const data = new FormData()
63
      const data = new FormData()
67
      data.append('code', code)
64
      data.append('code', code)
68
      setLoading(true)
65
      setLoading(true)
69
      const res = await axios.post('/account-settings/delete-account', data)
66
      const res = await axios.post('/account-settings/delete-account', data)
70
      handleAlert(res.data.success, res.data.data.message)
67
      handleAlert(res.data.success, res.data.data.message)
71
      if (res.data.success) {
68
      if (res.data.success) {
72
        logout()
69
        asyncLogout()
73
      }
70
      }
74
    } catch (error) {
71
    } catch (error) {
75
      handleAlert(false, 'Disculpe, ha ocurrido un error')
72
      handleAlert(false, 'Disculpe, ha ocurrido un error')
76
      console.log('>>: error > ', error)
73
      console.log('>>: error > ', error)