memos/web/src/grpcweb.ts
Mehad Nadeem 9c1e2f8137
feat: implemented link previews (frontend files) (#3074)
* feat: implmented link previews (frontend files)

* chore: updated frontend side for Link Previews

* chore: updated frontend gen types with the renamed (server) service file

* fix: passing errors

* chore: switched to using generated type instead of separate fields

* fix: passing linter error

* chore: updated Link.tsx

* chore: using `useResponsiveWidth` to render for different devices

* chore: refactored Link.tsx
2024-03-16 22:51:16 +08:00

43 lines
2.1 KiB
TypeScript

import { createChannel, createClientFactory, FetchTransport } from "nice-grpc-web";
import { ActivityServiceDefinition } from "./types/proto/api/v2/activity_service";
import { AuthServiceDefinition } from "./types/proto/api/v2/auth_service";
import { InboxServiceDefinition } from "./types/proto/api/v2/inbox_service";
import { LinkServiceDefinition } from "./types/proto/api/v2/link_service";
import { MemoServiceDefinition } from "./types/proto/api/v2/memo_service";
import { ResourceServiceDefinition } from "./types/proto/api/v2/resource_service";
import { TagServiceDefinition } from "./types/proto/api/v2/tag_service";
import { UserServiceDefinition } from "./types/proto/api/v2/user_service";
import { WebhookServiceDefinition } from "./types/proto/api/v2/webhook_service";
import { WorkspaceServiceDefinition } from "./types/proto/api/v2/workspace_service";
import { WorkspaceSettingServiceDefinition } from "./types/proto/api/v2/workspace_setting_service";
const channel = createChannel(
import.meta.env.VITE_API_BASE_URL || window.location.origin,
FetchTransport({
credentials: "include",
}),
);
const clientFactory = createClientFactory();
export const workspaceServiceClient = clientFactory.create(WorkspaceServiceDefinition, channel);
export const workspaceSettingServiceClient = clientFactory.create(WorkspaceSettingServiceDefinition, channel);
export const authServiceClient = clientFactory.create(AuthServiceDefinition, channel);
export const userServiceClient = clientFactory.create(UserServiceDefinition, channel);
export const memoServiceClient = clientFactory.create(MemoServiceDefinition, channel);
export const resourceServiceClient = clientFactory.create(ResourceServiceDefinition, channel);
export const tagServiceClient = clientFactory.create(TagServiceDefinition, channel);
export const inboxServiceClient = clientFactory.create(InboxServiceDefinition, channel);
export const activityServiceClient = clientFactory.create(ActivityServiceDefinition, channel);
export const webhookServiceClient = clientFactory.create(WebhookServiceDefinition, channel);
export const linkServiceClient = clientFactory.create(LinkServiceDefinition, channel);