backend: POST '/servlet/graphql' -> POST '/graphql'

This commit is contained in:
0x1eef 2024-01-14 20:15:19 -03:00
parent 7a6e6f368f
commit 116bf23da3
6 changed files with 18 additions and 21 deletions

View file

@ -10,7 +10,7 @@ module Twenty::Servlet::ServerMixin
# Returns an instance of WEBrick::HTTPServer.
def server(options = {})
server = WEBrick::HTTPServer.new server_options.merge(options)
server.mount "/servlet/graphql", Twenty::Servlet::GraphQL
server.mount "/graphql", Twenty::Servlet::GraphQL
server
end

View file

@ -0,0 +1,5 @@
import { InMemoryCache } from "@apollo/client";
export const CLIENT_OPTIONS = {
uri: "/graphql",
cache: new InMemoryCache(),
}

View file

@ -1,14 +1,12 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { Projects } from "/components/Projects";
import { ApolloProvider, ApolloClient, InMemoryCache } from "@apollo/client";
import { CLIENT_OPTIONS } from "/constants";
import { ApolloProvider, ApolloClient } from "@apollo/client";
(function () {
const root = document.querySelector(".react-root")!;
const client = new ApolloClient({
uri: "/servlet/graphql",
cache: new InMemoryCache(),
});
const client = new ApolloClient(CLIENT_OPTIONS);
ReactDOM.createRoot(root).render(
<ApolloProvider client={client}>
<Projects />

View file

@ -1,6 +1,7 @@
import { ApolloProvider, ApolloClient, InMemoryCache } from "@apollo/client";
import React from "react";
import ReactDOM from "react-dom/client";
import { ApolloProvider, ApolloClient } from "@apollo/client";
import { CLIENT_OPTIONS } from "/constants";
import { Task as Component } from "/components/Task";
(function () {
@ -10,10 +11,7 @@ import { Task as Component } from "/components/Task";
.split(",")
.map(e => e.split("=")),
);
const client = new ApolloClient({
uri: "/servlet/graphql",
cache: new InMemoryCache(),
});
const client = new ApolloClient(CLIENT_OPTIONS);
const root = document.querySelector(".react-root")!;
ReactDOM.createRoot(root).render(
<ApolloProvider client={client}>

View file

@ -1,14 +1,12 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { CLIENT_OPTIONS } from "/constants";
import { ApolloClient, ApolloProvider } from "@apollo/client";
import { Task } from "/components/Task";
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
(function () {
const root = document.querySelector(".react-root")!;
const client = new ApolloClient({
uri: "/servlet/graphql",
cache: new InMemoryCache(),
});
const client = new ApolloClient(CLIENT_OPTIONS);
ReactDOM.createRoot(root).render(
<ApolloProvider client={client}>
<Task />

View file

@ -1,14 +1,12 @@
import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client";
import React from "react";
import ReactDOM from "react-dom/client";
import { CLIENT_OPTIONS } from "/constants";
import { ApolloClient, ApolloProvider } from "@apollo/client";
import { Tasks } from "/components/Tasks";
(function () {
const root = document.querySelector(".react-root")!;
const client = new ApolloClient({
uri: "/servlet/graphql",
cache: new InMemoryCache(),
});
const client = new ApolloClient(CLIENT_OPTIONS);
ReactDOM.createRoot(root).render(
<ApolloProvider client={client}>
<Tasks />