1 import axios from 'axios';
2 import React, { useEffect, useState } from 'react';
3 import { useParams } from 'react-router-dom';
5 import NotFound from './NotFound';
6 import Seed from '../aos/Seed';
7 import ErrorBoundary from '../common/ErrorBoundary';
8 import ErrorMessage from '../common/ErrorMessage';
9 import Loading from '../common/Loading';
11 const AosSeed = () => {
12 const params = useParams();
13 const { hash } = params;
15 const [error, setError] = useState(null);
16 const [loading, setLoading] = useState(true);
17 const [patch, setPatch] = useState(null);
18 const [seed, setSeed] = useState(null);
22 const ctrl = new AbortController();
24 .get(`/api/aos-seed/${hash}`, { signal: ctrl.signal })
28 setSeed(response.data);
29 window.document.title = response.data.hash;
43 const ctrl = new AbortController();
45 .get(`/aos-seeds/${hash}.bps`, {
46 responseType: 'arraybuffer',
50 setPatch(response.data);
65 return <ErrorMessage error={error} />;
72 return <ErrorBoundary>
73 <Seed patch={patch} seed={seed} />
77 export default AosSeed;