about summary refs log tree commit diff
path: root/src/view/com/modals/EditProfile.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-10-04 11:10:24 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-10-04 11:10:24 -0500
commit0aaa406b179e366e6a527f052379184787440b42 (patch)
tree8e85b68c1557a9d3162e7bf1f3eaeda76950091d /src/view/com/modals/EditProfile.tsx
parentbf39791f011f19c6ff192eb223e15259dc9de53a (diff)
downloadvoidsky-0aaa406b179e366e6a527f052379184787440b42.tar.zst
Implement profile-update api
Diffstat (limited to 'src/view/com/modals/EditProfile.tsx')
-rw-r--r--src/view/com/modals/EditProfile.tsx18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/view/com/modals/EditProfile.tsx b/src/view/com/modals/EditProfile.tsx
index 72cbd4119..740d81895 100644
--- a/src/view/com/modals/EditProfile.tsx
+++ b/src/view/com/modals/EditProfile.tsx
@@ -6,6 +6,7 @@ import {ErrorMessage} from '../util/ErrorMessage'
 import {useStores} from '../../../state'
 import {ProfileViewModel} from '../../../state/models/profile-view'
 import {s, colors, gradients} from '../../lib/styles'
+import * as Profile from '../../../third-party/api/src/types/todo/social/profile'
 
 export const snapPoints = ['80%']
 
@@ -23,10 +24,19 @@ export function Component({profileView}: {profileView: ProfileViewModel}) {
       setError('')
     }
     try {
-      await profileView.updateProfile({
-        displayName,
-        description,
-      })
+      await profileView.updateProfile(
+        (existing?: Profile.Record): Profile.Record => {
+          if (existing) {
+            existing.displayName = displayName
+            existing.description = description
+            return existing
+          }
+          return {
+            displayName,
+            description,
+          }
+        },
+      )
       Toast.show('Profile updated', {
         position: Toast.positions.TOP,
       })