add: reset password and basic auth mock service

This commit is contained in:
Mahyar Khanbolooki
2025-07-01 00:27:16 +03:30
parent 2fc5b28925
commit a81659ef6e
13 changed files with 245 additions and 52 deletions
+41
View File
@@ -0,0 +1,41 @@
const BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'https://api.example.com'
export async function checkUserExists(phoneNumber: string): Promise<boolean> {
const res = phoneNumber === "123";
const data = { status: 200, result: { exists: res } }
return data.result.exists
}
export async function signup(userData: {
phoneNumber: string,
password: string
}) {
const res = userData.phoneNumber === "123" && userData.password === "123";
const data = { sucess: res }
return {
data,
user: {
id: '123',
name: 'John Doe',
number: userData.phoneNumber,
token: 'mock-jwt-token',
}
}
}
export async function login(credentials: {
phoneNumber: string,
password: string
}) {
const res = credentials.phoneNumber === "1234" && credentials.password === "1234";
const data = { sucess: res }
return {
data,
user: {
id: '1234',
name: 'Foo bar',
number: credentials.phoneNumber,
token: 'mock-jwt-token',
}
}
}