🐛 Fix StatusCode not being used properly

This commit is contained in:
ajnart
2023-03-02 19:57:24 +09:00
parent 05423440f3
commit 1dd205c441
2 changed files with 2 additions and 4 deletions

View File

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

View File

@@ -23,7 +23,7 @@ interface AppBehaviourType {
interface AppNetworkType { interface AppNetworkType {
enabledStatusChecker: boolean; enabledStatusChecker: boolean;
okStatus: number[]; statusCodes: string[];
} }
interface AppAppearanceType { interface AppAppearanceType {