( message?: string, )
| 451 | // Null unless the message parses into an object of strings; the same mutations |
| 452 | // also throw plain-string ValidationErrors |
| 453 | export const parseProfileFormHint = ( |
| 454 | message?: string, |
| 455 | ): ProfileFormHint | null => { |
| 456 | if (!message) { |
| 457 | return null; |
| 458 | } |
| 459 | |
| 460 | try { |
| 461 | const parsed = JSON.parse(message); |
| 462 | |
| 463 | if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) { |
| 464 | return null; |
| 465 | } |
| 466 | |
| 467 | return Object.fromEntries( |
| 468 | Object.entries(parsed).filter( |
| 469 | (entry): entry is [string, string] => typeof entry[1] === 'string', |
| 470 | ), |
| 471 | ); |
| 472 | } catch { |
| 473 | return null; |
| 474 | } |
| 475 | }; |
| 476 | |
| 477 | export const mutateUserInfo = async ( |
| 478 | data: Partial<UserProfile>, |
no outgoing calls
no test coverage detected