Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 3068 Rev 3517
Línea -... Línea 1...
-
 
1
/* eslint-disable react/prop-types */
1
import React, { useState } from "react";
2
import React, { useState } from "react";
2
import { addNotification } from "../redux/notification/notification.actions";
3
import { addNotification } from "../redux/notification/notification.actions";
3
import ConfirmationBox from "../shared/confirmation-box/ConfirmationBox";
4
import ConfirmationBox from "../shared/confirmation-box/ConfirmationBox";
4
import Spinner from "../shared/loading-spinner/Spinner";
5
import Spinner from "../shared/loading-spinner/Spinner";
5
import { axios } from "../utils";
6
import { axios } from "../utils";
6
import styled from 'styled-components'
7
import styled from 'styled-components'
7
import styles from './Profile.module.scss'
-
 
Línea 8... Línea 8...
8
 
8
 
9
const StyledSpinnerContainer = styled.div`
9
const StyledSpinnerContainer = styled.div`
10
  position: absolute;
10
  position: absolute;
11
  left: 0;
11
  left: 0;
Línea 116... Línea 116...
116
      });
116
      });
117
  };
117
  };
Línea 118... Línea 118...
118
 
118
 
119
  const handleUnfollow = async (link_unfollow) => {
119
  const handleUnfollow = async (link_unfollow) => {
120
    setLoading(true);
120
    setLoading(true);
121
    await axios.post(link_unfollow).then((response) => {
-
 
122
      const resData = response.data;
121
    await axios.post(link_unfollow)
123
      if (resData.success) {
122
      .then(({ data }) => {
124
        fetchCallback()
123
        if (data.success) fetchCallback()
125
      } else {
124
 
126
        if (resError.constructor.name !== "Object") {
125
        typeof data.data === 'string' &&
127
          addNotification({
126
          addNotification({
128
            style: "danger",
127
            style: "danger",
129
            msg: resData.data,
128
            msg: data.data
130
          });
-
 
131
        }
129
          })
132
      }
-
 
133
    });
130
      })
134
    setLoading(false);
131
    setLoading(false);
Línea 135... Línea 132...
135
  };
132
  };
136
 
133
 
137
  const getManageUrl = async () => {
134
  const getManageUrl = async () => {
138
    try {
-
 
139
      const res = await axios.get(link_admin)
135
    try {
140
      if (res.data.success) {
-
 
141
        window.open(res.data.data, '_backend')
136
      const { data } = await axios.get(link_admin)
142
      }
137
      if (data.success) window.open(data.data, '_backend')
143
    } catch (error) {
138
    } catch (error) {
144
      console.log('>>: error > ', error)
139
      console.log('>>: error > ', error)
Línea 145... Línea 140...
145
    }
140
    }
146
  }
141
  }
147
 
142
 
148
  return (
143
  return (
149
    <div className={styles.profile_info}>
144
    <div className='profile_info'>
150
      <div className={styles.profile_info_header}>
145
      <div className='profile_info_header'>
151
        {
146
        {
152
          !!image && (
147
          !!image && (
153
            <div className={styles.profile_info_header_imgContainer}>
148
            <div className='profile_info_header_imgContainer'>
154
              <img src={image} className="object-fit-contain" style={{ maxHeight: '100px' }} alt="group image" />
149
              <img src={image} className="object-fit-contain" style={{ maxHeight: '100px' }} alt="group image" />
155
            </div>
150
            </div>