refactor: shorten checkEndpoint further

This commit is contained in:
kunish 2023-08-30 18:03:05 +08:00
parent 1cffb4b305
commit fa167100c7
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430

View File

@ -21,7 +21,7 @@ export default () => {
navigate('/overview')
}
const checkEndpoint = ({ url, secret }: { url: string; secret: string }) =>
const checkEndpoint = (url: string, secret: string) =>
ky
.get(url, {
headers: secret
@ -40,9 +40,7 @@ export default () => {
return
}
if (
!(await checkEndpoint({ url: endpoint.url, secret: endpoint.secret }))
) {
if (!(await checkEndpoint(endpoint.url, endpoint.secret))) {
return
}
@ -62,7 +60,7 @@ export default () => {
return
}
if (!(await checkEndpoint({ url, secret }))) {
if (!(await checkEndpoint(url, secret))) {
return
}