Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
refactor: add error info to send invite results
Andrew Bastinfa4b130b181b
diff --git a/packages/hoppscotch-app/components/teams/Invite.vue b/packages/hoppscotch-app/components/teams/Invite.vueindex 4e191585f..fe4a313e4 100644--- a/packages/hoppscotch-app/components/teams/Invite.vue+++ b/packages/hoppscotch-app/components/teams/Invite.vue@@ -288,9 +288,10 @@ import { Email, EmailCodec } from "../../helpers/backend/types/Email"import { TeamMemberRole } from "../../helpers/backend/graphql"import {createTeamInvitation,+ CreateTeamInvitationErrors,revokeTeamInvitation,} from "../../helpers/backend/mutations/TeamInvitation"-import { useGQLQuery } from "~/helpers/backend/GQLClient"+import { GQLError, useGQLQuery } from "~/helpers/backend/GQLClient"import {GetPendingInvitesDocument,GetPendingInvitesQuery,@@ -374,11 +375,17 @@ const removeNewInvitee = (id: number) => {newInvites.value.splice(id, 1)}+type SendInvitesErrorType = {+ email: Email+ status: "error"+ error: GQLError<CreateTeamInvitationErrors>+} | {+ email: Email+ status: "success"+}+const sendInvitesResult = ref<- Array<{- email: Email- status: "error" | "success"- }>+ Array<SendInvitesErrorType>>([])const sendingInvites = ref<boolean>(false)@@ -418,9 +425,10 @@ const sendInvites = async () => {pipe(el,E.foldW(- () => ({+ (err) => ({status: "error" as const,email: newInvites.value[i].key as Email,+ error: err}),() => ({status: "success" as const,diff --git a/packages/hoppscotch-app/helpers/backend/mutations/TeamInvitation.ts b/packages/hoppscotch-app/helpers/backend/mutations/TeamInvitation.tsindex 0c217bf20..a6007d1bc 100644--- a/packages/hoppscotch-app/helpers/backend/mutations/TeamInvitation.ts+++ b/packages/hoppscotch-app/helpers/backend/mutations/TeamInvitation.ts@@ -15,7 +15,7 @@ import {} from "../graphql"import { Email } from "../types/Email"-type CreateTeamInvitationErrors =+export type CreateTeamInvitationErrors =| "invalid/email"| "team/invalid_id"| "team/member_not_found"