add: auth functionality basics

This commit is contained in:
Mahyar Khanbolooki
2025-07-01 19:30:54 +03:30
parent f1301140ba
commit ef63706116
10 changed files with 99 additions and 98 deletions
-19
View File
@@ -1,19 +0,0 @@
import { useAuthStore } from '@/zustand/userStore'
import { login } from '@/lib/api/auth'
export async function loginUser(phoneNumber: string, password: string) {
if (phoneNumber == "123" && password == "123") {
let response = login({
phoneNumber,
password,
})
{
const { login } = useAuthStore.getState()
login(response.user)
}
return true;
}
return false;
}
-19
View File
@@ -1,19 +0,0 @@
import { useAuthStore } from '@/zustand/userStore'
import { signup } from '@/lib/api/auth'
export async function signupUser(phoneNumber: string, password: string) {
if (phoneNumber == "1234" && password == "1234") {
let response = signup({
phoneNumber,
password,
})
{
const { login } = useAuthStore.getState()
login(response.user)
}
return true;
}
return false;
}
@@ -1,10 +0,0 @@
import { checkUserExists } from '@/lib/api/auth'
export async function validatePhoneNumber(phoneNumber: string): Promise<boolean> {
try {
return await checkUserExists(phoneNumber)
} catch (e) {
console.error(e)
return false
}
}