add: auth functionality basics
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user