ui(admin): start work on server startup settings

This commit is contained in:
Matthew Penner 2021-09-12 23:50:12 -06:00
parent 6362731d55
commit a615b7fa70
No known key found for this signature in database
GPG key ID: 030E4AB751DC756F
7 changed files with 239 additions and 157 deletions

View file

@ -0,0 +1,30 @@
import Label from '@/components/elements/Label';
import Select from '@/components/elements/Select';
import React, { useEffect, useState } from 'react';
import { Nest } from '@/api/admin/nests/getNests';
import searchNests from '@/api/admin/nests/searchNests';
export default ({ nestId, setNestId }: { nestId: number | null; setNestId: (value: number | null) => void }) => {
const [ nests, setNests ] = useState<Nest[] | null>(null);
useEffect(() => {
console.log(nestId || undefined);
searchNests({})
.then(nests => setNests(nests))
.catch(error => console.error(error));
}, []);
return (
<>
<Label>Nest</Label>
<Select value={nestId || undefined} onChange={e => setNestId(Number(e.currentTarget.value))}>
{nests?.map(v => (
<option key={v.id} value={v.id.toString()}>
{v.name}
</option>
))}
</Select>
</>
);
};