import React, { useEffect, useState } from 'react' import { Link } from 'react-router-dom' import ClipLoader from 'react-spinners/ClipLoader' import swal from 'sweetalert' import axios from 'axios' import { isAutheticated } from 'src/auth' function CopyrightMessage() { const [loading, setLoading] = useState(false) const token = isAutheticated() const [copyright, setCopyright] = useState('') useEffect(() => { async function getConfiguration() { const configDetails = await axios.get(`/api/config`, { headers: { Authorization: `Bearer ${token}`, }, }) configDetails.data.result.map((item) => { setCopyright(item?.copyrightMessage) }) } getConfiguration() }, []) async function handelChange(e) { setCopyright(e.target.value) } async function handelSubmit() { setLoading(true) let res = await axios.post(`/api/config/copyright/message`, { copyright }, { headers: { Authorization: `Bearer ${token}`, }, }) if (res) { setLoading(false) console.log(res) swal('Success!', res.data.message, res.data.status) } } return (