diff --git a/src/useRooms.ts b/src/useRooms.ts index 9a4ad0a..3e2e14e 100644 --- a/src/useRooms.ts +++ b/src/useRooms.ts @@ -62,6 +62,7 @@ export const useRooms = (orderByUpdatedAt?: boolean) => { const currentUser = await fetchUser(firebaseUser.uid) const roomUsers = [currentUser].concat(users) + metadata = Object.assign({}, metadata); const room = await firestore() .collection(ROOMS_COLLECTION_NAME) @@ -119,18 +120,19 @@ export const useRooms = (orderByUpdatedAt?: boolean) => { const currentUser = await fetchUser(firebaseUser.uid) const users = [currentUser].concat(otherUser) + metadata = Object.assign({}, metadata); const room = await firestore() .collection(ROOMS_COLLECTION_NAME) .add({ createdAt: firestore.FieldValue.serverTimestamp(), - imageUrl: undefined, + imageUrl: '', metadata, - name: undefined, + name: '', type: 'direct', updatedAt: firestore.FieldValue.serverTimestamp(), userIds: users.map((u) => u.id), - userRoles: undefined, + userRoles: '', }) return {