(collection: ModCollection)
| 250 | } |
| 251 | |
| 252 | export async function saveModCollection(collection: ModCollection): Promise<void> { |
| 253 | localStorage.setItem(STORAGE_KEY, JSON.stringify(collection)); |
| 254 | try { |
| 255 | await fetch(MODS_API, { |
| 256 | method: 'POST', |
| 257 | headers: { 'Content-Type': 'application/json' }, |
| 258 | body: JSON.stringify(collection), |
| 259 | }); |
| 260 | } catch { |
| 261 | // ignore |
| 262 | } |
| 263 | // Notify other components (e.g. ChatPanel) about the change |
| 264 | window.dispatchEvent(new CustomEvent('mod-collection-changed', { detail: collection })); |
| 265 | } |
| 266 | |
| 267 | // --------------------------------------------------------------------------- |
| 268 | // Collection helpers |
no outgoing calls
no test coverage detected