Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4538 Rev 4539
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { useEffect, useState } from 'react'
2
import React, { useEffect, useState } from 'react'
-
 
3
import { axios } from '../../../../../utils';
-
 
4
import { useDispatch } from 'react-redux';
-
 
5
import { setTimelineUrl } from '../../../../../redux/feed/feed.actions';
3
import FeedList from '../../../../../dashboard/templates/linkedin/Feed/FeedList';
6
import FeedList from '../../../../../dashboard/templates/linkedin/Feed/FeedList';
4
import GroupInfo from '../../../../../group/view/templates/linkedin/components/GroupInfo'
7
import GroupInfo from '../../../../../group/view/templates/linkedin/components/GroupInfo'
5
import { setTimelineUrl } from '../../../../../redux/feed/feed.actions';
-
 
6
import { axios } from '../../../../../utils';
-
 
7
import AboutCompany from '../components/AboutCompany';
8
import AboutCompany from '../components/AboutCompany';
8
import CompanyFollowers from '../components/CompanyFollowers';
9
import CompanyFollowers from '../components/CompanyFollowers';
Línea 9... Línea 10...
9
 
10
 
Línea 10... Línea 11...
10
const View = ({ backendVars }) => {
11
const View = ({ backendVars }) => {
11
 
-
 
12
    const [authorizedLinks, setAuthorizedLinks] = useState(null);
12
 
-
 
13
    const [authorizedLinks, setAuthorizedLinks] = useState(null);
Línea 13... Línea 14...
13
    const [followers, setFollowers] = useState(backendVars.totalFollowers);
14
    const [isFollower, setIsFollower] = useState(false);
14
    const [isFollower, setIsFollower] = useState(false);
15
    const dispatch = useDispatch()
15
 
16
 
16
    useEffect(() => {
17
    useEffect(() => {
Línea 17... Línea 18...
17
        setTimelineUrl(backendVars.timeline);
18
        dispatch(setTimelineUrl(backendVars.timeline))
18
        fetchAuthorizedLinks();
19
        fetchAuthorizedLinks();
19
    }, []);
-
 
20
 
20
    }, []);
21
    const fetchAuthorizedLinks = async () => {
21
 
22
        const response = await axios.get(`/company/view/${backendVars.companyId}`);
-
 
23
        const resData = response.data;
22
    const fetchAuthorizedLinks = async () => {
24
        if (resData.success) {
23
        const { data: response } = await axios.get(`/company/view/${backendVars.companyId}`);
25
            setAuthorizedLinks(resData.data);
24
        if (response.success) {
26
            setFollowers(resData.data.total_followers);
25
            setAuthorizedLinks(response.data);
27
            if (resData.data.link_unfollow) {
26
            if (response.data.link_unfollow) {
28
                setIsFollower(true);
27
                setIsFollower(true);
Línea 49... Línea 48...
49
                    />
48
                    />
50
                </div>
49
                </div>
51
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
50
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
52
                    {!isFollower
51
                    {!isFollower
53
                        ? <AboutCompany {...backendVars} />
52
                        ? <AboutCompany {...backendVars} />
54
                        : <FeedList
-
 
55
                            image={`/storage/type/company/code/${backendVars.companyId}/${backendVars.image ? `filename/${backendVars.image}` : ""}`}
53
                        : <FeedList image={`/storage/type/company/code/${backendVars.companyId}/${backendVars.image ? `filename/${backendVars.image}` : ""}`} />
56
                            routeTimeline={backendVars.timeline}
-
 
57
                        />
-
 
58
                    }
54
                    }
59
                </div>
55
                </div>
60
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
56
                <div className="d-flex flex-column" style={{ gap: '.5rem' }}>
61
                    <CompanyFollowers companyId={backendVars.companyId} />
57
                    <CompanyFollowers companyId={backendVars.companyId} />
62
                    <AboutCompany {...backendVars} />
58
                    <AboutCompany {...backendVars} />