Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.
wisp.place
1import { useState } from 'react'
2
3export interface UserInfo {
4 did: string
5 handle: string
6}
7
8export function useUserInfo() {
9 const [userInfo, setUserInfo] = useState<UserInfo | null>(null)
10 const [loading, setLoading] = useState(true)
11
12 const fetchUserInfo = async () => {
13 try {
14 const response = await fetch('/api/user/info')
15 const data = await response.json()
16 setUserInfo(data)
17 } catch (err) {
18 console.error('Failed to fetch user info:', err)
19 } finally {
20 setLoading(false)
21 }
22 }
23
24 return {
25 userInfo,
26 loading,
27 fetchUserInfo
28 }
29}