Merge pull request #750 from ajnart/fix-ping-status

🐛 Fix StatusCode not being used properly
This commit is contained in:
Thomas Camlong
2023-03-04 08:14:22 +09:00
committed by GitHub
6 changed files with 9 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ export const AppPing = ({ app }: AppPingProps) => {
queryKey: ['ping', { id: app.id, name: app.name }],
queryFn: async () => {
const response = await fetch(`/api/modules/ping?url=${encodeURI(app.url)}`);
const isOk = app.network.okStatus.includes(response.status);
const isOk = app.network.statusCodes.includes(response.status.toString());
return {
status: response.status,
state: isOk ? 'online' : 'down',
@@ -60,5 +60,3 @@ export const AppPing = ({ app }: AppPingProps) => {
</motion.div>
);
};
type PingState = 'loading' | 'down' | 'online';