CodeTarz
Editor
Gallery
Docs
PNG
SVG
Video
Copy
Share
app.ts
app.ts
Code
Diff
Auto
Format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
async function fetchUserData(userId: string) { const response = await fetch(`/api/users/${userId}`); if (!response.ok) { throw new Error(`Failed to fetch user: ${response.status}`); } const user = await response.json(); return { id: user.id, name: user.name, email: user.email, avatar: user.avatar_url, createdAt: new Date(user.created_at), }; }