( groveEnabled: boolean, )
| 118 | * Update Grove settings for the user account |
| 119 | */ |
| 120 | export async function updateGroveSettings( |
| 121 | groveEnabled: boolean, |
| 122 | ): Promise<void> { |
| 123 | try { |
| 124 | await withOAuth401Retry(() => { |
| 125 | const authHeaders = getAuthHeaders() |
| 126 | if (authHeaders.error) { |
| 127 | throw new Error(`Failed to get auth headers: ${authHeaders.error}`) |
| 128 | } |
| 129 | return axios.patch( |
| 130 | `${getOauthConfig().BASE_API_URL}/api/oauth/account/settings`, |
| 131 | { |
| 132 | grove_enabled: groveEnabled, |
| 133 | }, |
| 134 | { |
| 135 | headers: { |
| 136 | ...authHeaders.headers, |
| 137 | 'User-Agent': getClaudeCodeUserAgent(), |
| 138 | }, |
| 139 | }, |
| 140 | ) |
| 141 | }) |
| 142 | // Invalidate memoized settings so the post-toggle confirmation |
| 143 | // read in privacy-settings.tsx picks up the new value. |
| 144 | getGroveSettings.cache.clear?.() |
| 145 | } catch (err) { |
| 146 | logError(err) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Check if user is qualified for Grove (non-blocking, cache-first). |
no test coverage detected