Snai3i-LandingPage-FormBuilder / frontend / src / app / backend / endpoints / storm.ts
storm.ts
Raw
import api from "..";
const STORM_API = "api/storm";

export const stormApi = api.injectEndpoints({
  endpoints: (build) => ({
    generateCode: build.mutation<
      ResponseI<{
        email: string;
        code: string;
      }>,
      { email: string }
    >({
      query: (data) => ({
        url: `${STORM_API}/generate`,
        method: "POST",
        body: data,
      }),
    }),
    verifyCode: build.mutation<
      ResponseI<{
        storm: {
          email: string;
          code: string;
        };
        access: boolean;
      }>,
      { email: string; code: string }
    >({
      query: (data) => ({
        url: `${STORM_API}/verify`,
        method: "POST",
        body: data,
      }),
    }),
  }),
});

export const { useGenerateCodeMutation, useVerifyCodeMutation } = stormApi;