- This project is just build as hobby project
- The data won't be shared to third party, we maintain full privacy
- Don't use this project for your business without consent of author
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RandomUserAPIResponse, User } from "./types" | |
async function fetchRandomUser() { | |
try { | |
const response = await fetch('https://randomuser.me/api/') | |
const randomUser = await response.json() as RandomUserAPIResponse | |
return { user: randomUser.results[0] } as { success: true, user: User } |