fix: add browserHttpEndpoint for client-side Apollo requests

The Apollo Client was using httpEndpoint (http://localhost:3000/api/graphql)
for browser requests, which fails on remote servers. Added browserHttpEndpoint
as relative URL "/api/graphql" so browser requests go to the correct origin.
Also added error logging to setInboxHidden mutation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ruslan Bakiev
2026-02-24 10:40:08 +07:00
parent 5657da13c1
commit f553c26931
2 changed files with 3 additions and 0 deletions

View File

@@ -4367,6 +4367,8 @@ async function setInboxHidden(inboxId: string, hidden: boolean) {
inboxToggleLoadingById.value = { ...inboxToggleLoadingById.value, [id]: true }; inboxToggleLoadingById.value = { ...inboxToggleLoadingById.value, [id]: true };
try { try {
await doSetContactInboxHidden({ inboxId: id, hidden }); await doSetContactInboxHidden({ inboxId: id, hidden });
} catch (e: unknown) {
console.error("[setInboxHidden] mutation failed:", e);
} finally { } finally {
inboxToggleLoadingById.value = { ...inboxToggleLoadingById.value, [id]: false }; inboxToggleLoadingById.value = { ...inboxToggleLoadingById.value, [id]: false };
} }

View File

@@ -26,6 +26,7 @@ export default defineNuxtConfig({
clients: { clients: {
default: { default: {
httpEndpoint: process.env.GRAPHQL_HTTP_ENDPOINT || "http://localhost:3000/api/graphql", httpEndpoint: process.env.GRAPHQL_HTTP_ENDPOINT || "http://localhost:3000/api/graphql",
browserHttpEndpoint: "/api/graphql",
connectToDevTools: process.dev, connectToDevTools: process.dev,
httpLinkOptions: { httpLinkOptions: {
credentials: "include", credentials: "include",