Source

pages/Dashboard/ShareCertificate/ShareCertificate.jsx

import React, { useEffect, useState } from 'react'
import axios from 'axios';
import baseUrl from '../../../array/base/config';

/**
 * Represents  ShareCertificate component
 * @module ShareCertificate
 * @return {JSX.Element}
 */
const ShareCertificate = () => {
    /**
     * React useState for certificate list
     * @name CertificateList
     * @memberof module:ShareCertificate
     * @type {Array}
     * @default []
     */
    const [CertificateList, setCertificateList] = useState([])

    useEffect(() => {
        apicall()
    }, []);

    /**
     * Function for api call
     * @name apicall
     * @memberof module:ShareCertificate
     * @function apicall
     * @return {Promise<void>}
     */
    const apicall = async () => {
        try {
            const detail = localStorage.getItem('token')
            const response = await axios({
                method: 'get',
                url: `${baseUrl}/api/certificate/`,
                headers: {
                    "Authorization": `Token ${detail}`,
                },
            });
            setCertificateList(response.data)
        } catch (error) {
            console.log(error);
        }
    }


    return (
        <div>
            <h1>Shareholder's certificate</h1>
        </div>
    )
}

export default ShareCertificate;