--- name: common-pitfalls description: Apply when debugging errors, reviewing code for issues, or encountering unexpected behavior. Contains known mistakes with ChurchTools API, Vue components, TypeScript, Safari cookies, and form handling. --- # Common Pitfalls ## ChurchTools API | Pitfall | Wrong | Correct | |---------|-------|---------| | Nested params | `{ params: { key: 'val' } }` | `{ key: 'val' }` | | Delete method | `churchtoolsClient.delete()` | `churchtoolsClient.deleteApi()` | | Tags response | `response.data` | `response` (direct array) | | Tag domains | `'appointment'` | `'person' \| 'song' \| 'group'` | ## Vue Components | Pitfall | Wrong | Correct | |---------|-------|---------| | Button type | ` ``` ## API Error Handling Always wrap API calls in try-catch with loading states: ```typescript try { loading.value = true // API call } catch (err) { error.value = 'User-friendly message' console.error('Debug info:', err) } finally { loading.value = false } ```