Rearchitect

This commit is contained in:
oitsjustjose 2023-04-23 15:41:40 -05:00
commit 825d7c7246
13 changed files with 444 additions and 467 deletions

View file

@ -6,7 +6,7 @@ export default ({ id }) => {
useEffect(() => {
const handle = setInterval(async () => {
const resp = await fetch(`/api/v1/jobs/${id}`, { method: 'POST' });
if (resp.ok) {
if (resp.status < 500) {
setLogs(await resp.text());
} else {
setLogs(`${resp.status}: ${resp.statusText}`);

View file

@ -14,12 +14,12 @@ export default () => {
const [jobId, setJobId] = useState(window.localStorage.getItem('last-jobid'));
const [formData, setFormData] = useState({
githubPat: '',
slug: '',
projId: '',
curseforgeSlug: '',
modrinthId: '',
});
// eslint-disable-next-line max-len
const isValidState = () => !!formData.githubPat.length && !!formData.slug.length && !!formData.projId.length;
const isValidState = () => !!formData.githubPat.length && !!formData.curseforgeSlug.length && !!formData.modrinthId.length;
const makeJob = async (evt) => {
evt.preventDefault();
@ -69,10 +69,10 @@ export default () => {
type="text"
required
placeholder="This field is required"
value={formData.slug}
value={formData.curseforgeSlug}
onChange={(x) => setFormData({
...formData,
slug: x.target.value,
curseforgeSlug: x.target.value,
})}
/>
</Form.Group>
@ -83,10 +83,10 @@ export default () => {
type="text"
required
placeholder="This field is required"
value={formData.projId}
value={formData.modrinthId}
onChange={(x) => setFormData({
...formData,
projId: x.target.value,
modrinthId: x.target.value,
})}
/>
</Form.Group>