1 import axios from 'axios';
2 import React, { useCallback, useEffect, useState } from 'react';
4 import Generate from '../aos-generate/Generate';
5 import ErrorBoundary from '../common/ErrorBoundary';
6 import ErrorMessage from '../common/ErrorMessage';
7 import Loading from '../common/Loading';
8 import i18n from '../../i18n';
10 const AosGenerate = () => {
11 const [error, setError] = useState(null);
12 const [loading, setLoading] = useState(true);
13 const [presets, setPresets] = useState([]);
15 const loadPresets = useCallback(ctrl => {
17 .get('/api/aos-presets', { signal: ctrl.signal })
21 setPresets(response.data);
32 const ctrl = new AbortController();
40 window.document.title = i18n.t('aosGenerate.heading');
48 return <ErrorMessage error={error} />;
51 return <ErrorBoundary>
52 <Generate presets={presets} />
56 export default AosGenerate;