From 9a4dc7bab818bd5c8e26677010ed08ed1df92444 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Wed, 1 Apr 2026 19:20:58 +0700 Subject: [PATCH] Switch Telegram/Max login to bot temporary token flow --- app/composables/graphql/generated.ts | 49 ++++++++ app/pages/login.vue | 114 ++++++++++++++++-- .../auth/consume-login-token.graphql | 12 ++ graphql/schema.graphql | 1 + nuxt.config.ts | 2 + 5 files changed, 166 insertions(+), 12 deletions(-) create mode 100644 graphql/operations/auth/consume-login-token.graphql diff --git a/app/composables/graphql/generated.ts b/app/composables/graphql/generated.ts index 3b428f0..051ef35 100644 --- a/app/composables/graphql/generated.ts +++ b/app/composables/graphql/generated.ts @@ -139,6 +139,7 @@ export type Mutation = { clientReviewOrder: Order; completeOrder: Order; connectMessenger: MessengerConnection; + consumeLoginToken: AuthSession; createInvitation: Invitation; createReferral: ReferralLink; managerFinalizeOrder: Order; @@ -187,6 +188,11 @@ export type MutationConnectMessengerArgs = { }; +export type MutationConsumeLoginTokenArgs = { + token: Scalars['String']['input']; +}; + + export type MutationCreateInvitationArgs = { input: CreateInvitationInput; }; @@ -510,6 +516,13 @@ export enum WithdrawalStatus { Rejected = 'REJECTED' } +export type ConsumeLoginTokenMutationVariables = Exact<{ + token: Scalars['String']['input']; +}>; + + +export type ConsumeLoginTokenMutation = { __typename?: 'Mutation', consumeLoginToken: { __typename?: 'AuthSession', accessToken: string, expiresAt: any, user: { __typename?: 'User', id: string, email: string, fullName: string, role: UserRole } } }; + export type RegisterSelfMutationVariables = Exact<{ input: RegisterSelfInput; }>; @@ -598,6 +611,42 @@ export type ConnectMessengerMutationVariables = Exact<{ export type ConnectMessengerMutation = { __typename?: 'Mutation', connectMessenger: { __typename?: 'MessengerConnection', id: string, type: MessengerType, channelId: string, isActive: boolean } }; +export const ConsumeLoginTokenDocument = gql` + mutation ConsumeLoginToken($token: String!) { + consumeLoginToken(token: $token) { + accessToken + expiresAt + user { + id + email + fullName + role + } + } +} + `; + +/** + * __useConsumeLoginTokenMutation__ + * + * To run a mutation, you first call `useConsumeLoginTokenMutation` within a Vue component and pass it any options that fit your needs. + * When your component renders, `useConsumeLoginTokenMutation` returns an object that includes: + * - A mutate function that you can call at any time to execute the mutation + * - Several other properties: https://v4.apollo.vuejs.org/api/use-mutation.html#return + * + * @param options that will be passed into the mutation, supported options are listed on: https://v4.apollo.vuejs.org/guide-composable/mutation.html#options; + * + * @example + * const { mutate, loading, error, onDone } = useConsumeLoginTokenMutation({ + * variables: { + * token: // value for 'token' + * }, + * }); + */ +export function useConsumeLoginTokenMutation(options: VueApolloComposable.UseMutationOptions | ReactiveFunction> = {}) { + return VueApolloComposable.useMutation(ConsumeLoginTokenDocument, options); +} +export type ConsumeLoginTokenMutationCompositionFunctionResult = VueApolloComposable.UseMutationReturn; export const RegisterSelfDocument = gql` mutation RegisterSelf($input: RegisterSelfInput!) { registerSelf(input: $input) { diff --git a/app/pages/login.vue b/app/pages/login.vue index 5d8eaa9..4f449ac 100644 --- a/app/pages/login.vue +++ b/app/pages/login.vue @@ -1,6 +1,7 @@