force check api online via JSON response

This commit is contained in:
timothycarambat 2023-08-16 15:43:46 -07:00
parent 8af817e2d5
commit a62e891fa0
3 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,8 @@ import { baseHeaders } from "../utils/request";
const System = {
ping: async function () {
return await fetch(`${API_BASE}/ping`)
.then((res) => res.ok)
.then((res) => res.json())
.then((res) => res?.online || false)
.catch(() => false);
},
totalIndexes: async function () {

View File

@ -1,5 +1,4 @@
export const API_BASE =
import.meta.env.VITE_API_BASE || "/api";
export const API_BASE = import.meta.env.VITE_API_BASE || "/api";
export const AUTH_USER = "anythingllm_user";
export const AUTH_TOKEN = "anythingllm_authToken";

View File

@ -40,7 +40,7 @@ function systemEndpoints(app) {
if (!app) return;
app.get("/ping", (_, response) => {
response.sendStatus(200);
response.status(200).json({ online: true });
});
app.get("/migrate", async (_, response) => {