* feat: add simple ping * refactor: make ping run on server and show errors * fix: format issues * fix: missing translation for enabled ping option for app * refactor: remove ping queue as no longer needed * chore: address pull request feedback * test: add some unit tests * fix: format issues * fix: deepsource issues
14 lines
389 B
TypeScript
14 lines
389 B
TypeScript
import { extractErrorMessage } from "@homarr/common";
|
|
import { logger } from "@homarr/log";
|
|
|
|
export const sendPingRequestAsync = async (url: string) => {
|
|
try {
|
|
return await fetch(url).then((response) => ({ statusCode: response.status }));
|
|
} catch (error) {
|
|
logger.error("packages/ping/src/index.ts:", error);
|
|
return {
|
|
error: extractErrorMessage(error),
|
|
};
|
|
}
|
|
};
|