Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

896 B
Raw Blame
import { authServiceClient, type ConsentScopes } from '@service-auth/client';
import { useMutation } from '@tanstack/solid-query';

/**
 * Mutation that asks auth-service for the Google OAuth authorization URL for
 * adding a Gmail inbox to the already-authenticated user. Callers consume the
 * `authorization_url` and navigate the browser to it. `scopes` selects which
 * permissions the consent screen asks for. Calendar entry points and reconnects
 * of inboxes that already used calendar request calendar access.
 */
export function useInitGmailLink() {
  return useMutation(() => ({
    mutationFn: async (params: {
      originalUrl: string;
      scopes?: ConsentScopes;
      reconnectLinkId?: string;
    }) => {
      return authServiceClient.initGmailLink(params.originalUrl, {
        scopes: params.scopes,
        reconnectLinkId: params.reconnectLinkId,
      });
    },
  }));
}