export interface PJ { full_name: string short_name: string nick: string health: number mana: number max_mana: number max_health: number race: string uuid: string image?: string } export async function fetchMyPjs (setError: (set: string | null) => void): Promise { const response = await fetch('/my/pjs', { method: 'GET', mode: 'same-origin', cache: 'no-cache' }).catch((error) => { console.log(error) setError('Error recuperando tus pjs') }) if (response === undefined) { return [] } const statusCode = response.status const data = await response.json() if (statusCode !== 200) { setError(data.error) return [] } return data }