The applications tracker, leads inbox, email pipeline and capture userscript move here from web_server's backend, Python service and Vue app, as one Go binary that serves its own Vue SPA under /jobs/. - The Go services, resolvers and tests move over almost unchanged. - The three Claude calls are ported from Python to Go (internal/claude), with the same prompts, per-model request shaping and error messages. - There is no login: internal/auth asks the site backend's /auth/validate-admin with the visitor's cookies, and relays refreshed cookies back. - A Settings page replaces the admin-panel capture token card and adds the Microsoft sign-in link and a manual email sync. - The userscript is 2.0.0, at /jobs/, and migrates a saved API base. - Dockerfile, a standalone compose with Postgres, Makefile, and a Gitea CI workflow that tests and publishes the image. Co-Authored-By: Claude Opus 5.5 <[email protected]>
23 lines
850 B
JavaScript
23 lines
850 B
JavaScript
/**
|
|
* The app's entire GraphQL client: a thin axios POST to the tracker's
|
|
* /jobs/api/graphql. Every Pinia store goes through this; there is no cache
|
|
* or normalisation layer.
|
|
*
|
|
* Auth rides along in the main site's HTTP-only cookies, which the browser
|
|
* sends because the request is same-origin (nginx in production, the Vite
|
|
* proxy in dev). A lapsed session sends the browser to the site's login.
|
|
*/
|
|
|
|
import axios from "axios";
|
|
import { ADMIN_REQUIRED, goToLogin } from "@/session";
|
|
|
|
export async function gql(query, variables = {}) {
|
|
const res = await axios.post(`${import.meta.env.BASE_URL}api/graphql`, { query, variables });
|
|
const errors = res.data.errors;
|
|
if (errors?.some((e) => e.message === ADMIN_REQUIRED)) {
|
|
goToLogin();
|
|
}
|
|
if (errors && !res.data.data) throw new Error(errors[0].message);
|
|
return res.data.data;
|
|
}
|