-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathapi.ts
More file actions
67 lines (63 loc) · 1.5 KB
/
Copy pathapi.ts
File metadata and controls
67 lines (63 loc) · 1.5 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
export interface SignUpData {
email: string;
password: string;
confirmPassword: string;
}
export interface SignInData {
email: string;
password: string;
}
export interface AuthResponse {
success: boolean;
message: string;
user?: {
email: string;
id: string;
};
}
// Mock registration function
export const mockRegister = async (data: SignUpData): Promise<AuthResponse> => {
return new Promise((resolve, reject) => {
setTimeout(() => {
// Simulate validation
if (data.email === "test@example.com") {
reject({
success: false,
message: "Email already exists",
});
} else {
resolve({
success: true,
message: "Registration successful!",
user: {
email: data.email,
id: Math.random().toString(36).substring(7),
},
});
}
}, 1500);
});
};
// Mock login function
export const mockLogin = async (data: SignInData): Promise<AuthResponse> => {
return new Promise((resolve, reject) => {
setTimeout(() => {
// Simulate authentication
if (data.email === "demo@peercall.com" && data.password === "password123") {
resolve({
success: true,
message: "Login successful!",
user: {
email: data.email,
id: "demo-user-123",
},
});
} else {
reject({
success: false,
message: "Invalid email or password",
});
}
}, 1500);
});
};