Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 5763 | Rev 5765 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import axios from 'axios'
import React, { useEffect, useState } from 'react'

const ProfileView = ({ urlVars }) => {

  const {
    routeWebsite,
    routeCompanySize,
    routeIndustry,
    routeExtended,
    routeSocialNetworks,
    routeLocationAdd,
    routeFoundationYear,
    routeImageUpload,
    routeCoverUpload,
    routeFooterUpload,
    routeHeaderUpload,
    companyId,
    cover
  } = urlVars

  const [coverPath, setCoverPath] = useState({
    path: `/storage/type/user-cover/code/${companyId}/${cover && `filename/${cover}/`
      }`,
    uid: Date.now(),
  });

  const getData = async (url) => {
    try {
      const { data } = await axios.get(url)

      return data.data
    }
    catch (err) {
      console.log(err)
    }
  }

  useEffect(() => {
    getData(routeCoverUpload)
      .then(resp => console.log(resp))
      .catch(err => console.log(err))

    console.log(urlVars)
  }, []);

  return (
    <>
      <section class="content-header">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-12">
              <h1>Perfil</h1>
            </div>
          </div>
        </div>
      </section>
      <input type="text" name="test" id="test" style="display: none" />
      <div class="row">
        <div class="col-12">
          <section class="cover-sec">
            <img
              id="user-cover-img"
              src={`${coverPath.path}?${coverPath.uid}`}
              alt=""
            />
            <div class="add-pic-box change-cover-image">
              <div class="container">
                <div class="row no-gutters">
                  <div class="col-lg-12 col-sm-12">
                    <a href="#" class="btn-cover-open">
                      <i class="fa fa-camera"></i>
                    </a>
                  </div>
                </div>
              </div>
            </div>
          </section>
        </div>
      </div>
    </>
  )
}

export default ProfileView