Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 5, 2024
1 parent 1a84275 commit 1183d57
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/hooks/useRefField.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useState, useEffect, useMemo } from "react";

function fetchRef(repository, refType) {
return fetch(`https://api.github.com/repos/${repository}/${refType}`)
.then((r) => {
return fetch(`https://api.github.com/repos/${repository}/${refType}`).then(
(r) => {
if (r.ok) return r.json();
})
},
);
}

export default function useRefField(repository) {
Expand All @@ -23,14 +24,13 @@ export default function useRefField(repository) {
Promise.all([
fetchRef(repository, "branches"),
fetchRef(repository, "tags"),
])
.then((results) => {
const refOptions = results.flat().map(({ name }) => ({
label: name,
value: name,
}));
setOptions(refOptions);
})
]).then((results) => {
const refOptions = results.flat().map(({ name }) => ({
label: name,
value: name,
}));
setOptions(refOptions);
});
}
}, [repository]);

Expand Down

0 comments on commit 1183d57

Please sign in to comment.