refactor: enhance authentication and signup flow with new providers, update middleware matcher, and improve type safety for API responses

This commit is contained in:
2025-03-26 22:48:14 +05:00
parent 32bb01b656
commit 99c5fef748
14 changed files with 222 additions and 78 deletions

View File

@ -46,3 +46,21 @@ export async function logout({ token }: { token: string }) {
// Since the API endpoint returns 204 No Content on success, we don't need to parse JSON
return null; // Return null to indicate a successful logout with no content
}
export async function checkIdOrPhone({
id_card,
phone_number,
}: { id_card?: string; phone_number?: string }) {
console.log("id_card and phone_number", { id_card, phone_number });
const response = await fetch(
`${process.env.SARLINK_API_BASE_URL}/api/auth/users/filter/?id_card=${id_card}&mobile=${phone_number}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
},
);
const data = await response.json();
return data;
}