chore: update process

This commit is contained in:
shuai 2022-11-03 18:44:28 +08:00
parent 3d015db8a1
commit a85a45425a
2 changed files with 30 additions and 8 deletions

View File

@ -1,17 +1,20 @@
import { useState } from 'react'; import { useState } from 'react';
import { Container, Row, Col, Card, Button } from 'react-bootstrap'; import { Container, Row, Col, Card, Button, Spinner } from 'react-bootstrap';
import { useTranslation, Trans } from 'react-i18next'; import { useTranslation, Trans } from 'react-i18next';
import { PageTitle } from '@/components'; import { PageTitle } from '@/components';
import { upgradSystem } from '@/services';
const Index = () => { const Index = () => {
const { t } = useTranslation('translation', { const { t } = useTranslation('translation', {
keyPrefix: 'upgrade', keyPrefix: 'upgrade',
}); });
const [step, setStep] = useState(1); const [step] = useState(1);
const [loading, setLoading] = useState(false);
const handleUpdate = () => { const handleUpdate = async () => {
setStep(2); await upgradSystem();
setLoading(true);
}; };
return ( return (
<div className="page-wrap2"> <div className="page-wrap2">
@ -29,9 +32,22 @@ const Index = () => {
i18nKey="upgrade.update_description" i18nKey="upgrade.update_description"
components={{ 1: <p /> }} components={{ 1: <p /> }}
/> />
<Button className="float-end" onClick={handleUpdate}> {loading ? (
{t('update_btn')} <Button variant="primary" disabled className="float-end">
</Button> <Spinner
as="span"
animation="border"
size="sm"
role="status"
aria-hidden="true"
/>
<span> {t('update_btn')}</span>
</Button>
) : (
<Button className="float-end" onClick={handleUpdate}>
{t('update_btn')}
</Button>
)}
</> </>
)} )}
@ -39,7 +55,9 @@ const Index = () => {
<> <>
<h5>{t('done_title')}</h5> <h5>{t('done_title')}</h5>
<p>{t('done_desscription')}</p> <p>{t('done_desscription')}</p>
<Button className="float-end">{t('done_btn')}</Button> <Button className="float-end" href="/">
{t('done_btn')}
</Button>
</> </>
)} )}
</Card.Body> </Card.Body>

View File

@ -266,3 +266,7 @@ export const useSiteSettings = () => {
error, error,
}; };
}; };
export const upgradSystem = () => {
return request.post('/answer/api/v1/upgradation');
};