Skip to content
Snippets Groups Projects
Commit a62e891f authored by timothycarambat's avatar timothycarambat
Browse files

force check api online via JSON response

parent 8af817e2
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,8 @@ import { baseHeaders } from "../utils/request"; ...@@ -4,7 +4,8 @@ import { baseHeaders } from "../utils/request";
const System = { const System = {
ping: async function () { ping: async function () {
return await fetch(`${API_BASE}/ping`) return await fetch(`${API_BASE}/ping`)
.then((res) => res.ok) .then((res) => res.json())
.then((res) => res?.online || false)
.catch(() => false); .catch(() => false);
}, },
totalIndexes: async function () { totalIndexes: async function () {
......
export const API_BASE = export const API_BASE = import.meta.env.VITE_API_BASE || "/api";
import.meta.env.VITE_API_BASE || "/api";
export const AUTH_USER = "anythingllm_user"; export const AUTH_USER = "anythingllm_user";
export const AUTH_TOKEN = "anythingllm_authToken"; export const AUTH_TOKEN = "anythingllm_authToken";
...@@ -40,7 +40,7 @@ function systemEndpoints(app) { ...@@ -40,7 +40,7 @@ function systemEndpoints(app) {
if (!app) return; if (!app) return;
app.get("/ping", (_, response) => { app.get("/ping", (_, response) => {
response.sendStatus(200); response.status(200).json({ online: true });
}); });
app.get("/migrate", async (_, response) => { app.get("/migrate", async (_, response) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment