import { Injectable } from '@nestjs/common';
import axios from 'axios';

@Injectable()
export class ResendOtpService {

  async sendOtp(mobileNumber: string, type: string): Promise<any> {

    const url = `https://control.msg91.com/api/v5/otp/retry?retrytype=${type}&mobile=${mobileNumber}`;

    const headers = {
      accept: 'application/json',
      'content-type': 'application/json',
      authkey: '403400AF0OnTHLXvN691d649fP1',
    };

    try {
      console.log(url, "url");
      console.log(headers, "headers");



      const response = await axios.post(url, headers);
      // console.log(response);

      return response.data;
    } catch (error) {
      throw error;
    }
  }

}
