(isRefresh = false, {priority = FOREGROUND_PRIORITY} = {})
| 302 | |
| 303 | const response = await apiJson(TOGGLE_NICKNAME); |
| 304 | const nextDisplayName = response?.['name']; |
| 305 | |
| 306 | await Promise.all([ |
| 307 | removeCacheValue("displayName"), |
| 308 | removeCacheValue("applicants"), |
| 309 | removeCacheValue("records"), |
| 310 | ...(originalDisplayName ? [removeCacheValue(metadataCacheKey(originalDisplayName))] : []), |
| 311 | ...(nextDisplayName ? [removeCacheValue(metadataCacheKey(nextDisplayName))] : []), |
| 312 | ...(originalDisplayName && originalAvatarId |
| 313 | ? [removeCacheValue(avatarCacheKey(originalDisplayName, originalAvatarId))] |
| 314 | : []), |
| 315 | ]); |
| 316 | } |
| 317 | |
| 318 | export async function updateContact(contact) { |
| 319 | const normalizedContact = typeof contact === 'string' ? JSON.parse(contact) : contact; |
| 320 | await apiRequest(UPDATE_CONTACT, {body: {newContact: normalizedContact}}); |
| 321 | await invalidateMetadataCache(); |
no test coverage detected