MCPcopy Create free account
hub / github.com/Noumena-Network/code / updateGroveSettings

Function updateGroveSettings

src/services/api/grove.ts:140–168  ·  view source on GitHub ↗
(
  groveEnabled: boolean,
)

Source from the content-addressed store, hash-verified

138 * Update Grove settings for the user account
139 */
140export async function updateGroveSettings(
141 groveEnabled: boolean,
142): Promise<void> {
143 try {
144 await withOAuth401Retry(() => {
145 const authHeaders = getAuthHeaders()
146 if (authHeaders.error) {
147 throw new Error(`Failed to get auth headers: ${authHeaders.error}`)
148 }
149 return axios.patch(
150 buildNoumenaPlatformUrl('/api/oauth/account/settings'),
151 {
152 grove_enabled: groveEnabled,
153 },
154 {
155 headers: {
156 ...authHeaders.headers,
157 'User-Agent': getNcodeUserAgent(),
158 },
159 },
160 )
161 })
162 // Invalidate memoized settings so the post-toggle confirmation
163 // read in privacy-settings.tsx picks up the new value.
164 getGroveSettings.cache.clear?.()
165 } catch (err) {
166 logError(err)
167 }
168}
169
170/**
171 * Check if user is qualified for Grove (non-blocking, cache-first).

Callers 2

GroveDialogFunction · 0.85
PrivacySettingsDialogFunction · 0.85

Calls 6

withOAuth401RetryFunction · 0.85
buildNoumenaPlatformUrlFunction · 0.85
getNcodeUserAgentFunction · 0.85
getAuthHeadersFunction · 0.50
logErrorFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected