Face_Classify_frontend/app/src/components/Test/Test.js

73 lines
2.3 KiB
JavaScript

import { UserOutlined } from '@ant-design/icons';
import { Avatar, Tooltip } from 'antd';
import axios from 'axios';
import ModalEditLabel from '../Modal/ModaEditLabel';
import momment from 'moment';
import React, { useEffect, useState } from 'react';
import Pagination from "react-js-pagination";
import { PulseLoader } from 'react-spinners';
import { HOST } from '../../config/index';
import swal from 'sweetalert';
import { useLocation } from 'react-router-dom';
export default function Test() {
const [text, setText] = useState("")
const [loading, setLoading] = useState(false)
const test = () => {
setLoading(true)
try {
let result = axios.get(`${HOST}/api/test_accuracy`)
.then(response => {
console.log(response)
setText(response.data.data)
})
.catch(error => {
console.log(error);
});
} catch (error) {
console.log(error);
}
setLoading(false)
}
return (
<div>
<div className="m-portlet m-portlet--mobile pb-3">
<div className="m-portlet__head">
<div className="m-portlet__head-caption">
<div className="m-portlet__head-title">
<h3 className="m-portlet__head-text">
Test
</h3>
</div>
</div>
</div>
<div className="m-portlet__body pt-2">
<div className="pb-4 pt-4">
<button type="button" onClick={() => test()} className="btn btn-success">Test</button>
</div>
<PulseLoader
// css={override}
sizeUnit={"px"}
size={12}
margin={'2px'}
color={'#36D7B7'}
loading={loading}
/>
{text.length > 0 && text.map((item, index) => {
return (
<p>{item}</p>
)
})}
</div>
</div>
</div>
)
}