mirror of https://github.com/usememos/memos
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
507 B
TypeScript
16 lines
507 B
TypeScript
2 years ago
|
import { createChannel, createClientFactory, FetchTransport } from "nice-grpc-web";
|
||
|
import { UserServiceDefinition } from "./types/proto-grpcweb/api/v2/user_service";
|
||
|
|
||
|
const address = import.meta.env.MODE === "development" ? "http://localhost:8081" : window.location.origin;
|
||
|
|
||
|
const channel = createChannel(
|
||
|
address,
|
||
|
FetchTransport({
|
||
|
credentials: "include",
|
||
|
})
|
||
|
);
|
||
|
|
||
|
const clientFactory = createClientFactory();
|
||
|
|
||
|
export const userServiceClient = clientFactory.create(UserServiceDefinition, channel);
|