()
| 194 | } |
| 195 | |
| 196 | export async function loadCharacterCollection(): Promise<CharacterCollection | null> { |
| 197 | try { |
| 198 | const res = await fetch(CHARACTER_API); |
| 199 | if (res.ok) { |
| 200 | const data = await res.json(); |
| 201 | if (data && data.activeId && data.items) { |
| 202 | localStorage.setItem(STORAGE_KEY, JSON.stringify(data)); |
| 203 | return data as CharacterCollection; |
| 204 | } |
| 205 | } |
| 206 | } catch (e) { |
| 207 | console.warn('[CharacterManager] loadCharacterCollection API not available:', e); |
| 208 | } |
| 209 | return null; |
| 210 | } |
| 211 | |
| 212 | export function loadCharacterCollectionSync(): CharacterCollection | null { |
| 213 | try { |
no test coverage detected