blob: af1bbd997d0141c786e57cee9379d152b12045a7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import axios from 'axios';
const API_URL = 'https://yourapi.com/api/email';
const generateOtp = () => Math.floor(100000 + Math.random() * 900000);
export const sendOtp = async (email) => {
const otp = generateOtp();
await axios.post(`${API_URL}/send-otp`, { email, otp });
localStorage.setItem('otp', otp);
};
export const verifyOtp = (enteredOtp) => {
const savedOtp = localStorage.getItem('otp');
return enteredOtp === savedOtp;
};
export const sendInvoice = async (cart) => {
await axios.post(`${API_URL}/send-invoice`, { cart });
};
export default {
sendOtp,
verifyOtp,
sendInvoice,
};
|