@@ -26,22 +26,16 @@ const ZOME_FN_NAMES = {
2626 FETCH_AGENT_ADDRESS : 'fetch_agent_address' ,
2727}
2828interface IProfilesApi {
29- createWhoami : (
30- payload : Profile
31- ) => Promise < WireRecord < Profile > >
32- updateWhoami : (
33- payload : UpdateInput < Profile >
34- ) => Promise < WireRecord < Profile > >
29+ createWhoami : ( payload : Profile ) => Promise < WireRecord < Profile > >
30+ updateWhoami : ( payload : UpdateInput < Profile > ) => Promise < WireRecord < Profile > >
3531 whoami : ( ) => Promise < WhoAmIOutput >
3632 fetchAgents : ( ) => Promise < Array < Profile > >
3733 fetchAgentAddress : ( ) => Promise < AgentPubKeyB64 >
3834}
3935
40- const ProfilesApi = ( appWebsocket : AppClient , cellId : CellId ) : IProfilesApi => {
36+ const ProfilesApi = ( appWebsocket : AppClient , cellId : CellId ) : IProfilesApi => {
4137 return {
42- createWhoami : async (
43- payload : Profile
44- ) : Promise < WireRecord < Profile > > => {
38+ createWhoami : async ( payload : Profile ) : Promise < WireRecord < Profile > > => {
4539 return callZome (
4640 appWebsocket ,
4741 cellId ,
@@ -94,7 +88,11 @@ const ProfilesApi = (appWebsocket: AppClient, cellId :CellId): IProfilesApi => {
9488export default class ProfilesZomeApi {
9589 appWebsocket : AppClient
9690 profile : IProfilesApi
97- constructor ( appWebsocket : AppClient , cellId : CellId , profilesClient ?: ProfilesClient ) {
91+ constructor (
92+ appWebsocket : AppClient ,
93+ cellId : CellId ,
94+ profilesClient ?: ProfilesClient
95+ ) {
9896 this . appWebsocket = appWebsocket
9997 this . profile = profilesClient
10098 ? WeaveProfilesApi ( profilesClient )
@@ -111,9 +109,9 @@ export function weaveToAcornProfile(
111109 agentPubKey : string
112110) : Profile {
113111 return {
114- avatarUrl : weaveProfile . fields [ 'avatar' ] ,
112+ avatarUrl : weaveProfile . fields [ 'avatar' ] || '' ,
115113 agentPubKey,
116- status : " Online" ,
114+ status : ' Online' ,
117115 firstName : weaveProfile . nickname ,
118116 lastName : '' ,
119117 handle : weaveProfile . nickname ,
@@ -136,15 +134,17 @@ function acornToWeaveProfile(
136134const WeaveProfilesApi = ( profilesClient : ProfilesClient ) : IProfilesApi => {
137135 const myPubKey = profilesClient . client . myPubKey
138136 return {
139- createWhoami : async (
140- _payload : Profile
141- ) : Promise < WireRecord < Profile > > => {
142- throw new Error ( "Cannot create profile. Profile must be received via WeaveClient." )
137+ createWhoami : async ( _payload : Profile ) : Promise < WireRecord < Profile > > => {
138+ throw new Error (
139+ 'Cannot create profile. Profile must be received via WeaveClient.'
140+ )
143141 } ,
144142 updateWhoami : async (
145143 payload : UpdateInput < Profile >
146144 ) : Promise < WireRecord < Profile > > => {
147- throw new Error ( "Cannot update profile. Profile must be updated in the Moss group." )
145+ throw new Error (
146+ 'Cannot update profile. Profile must be updated in the Moss group.'
147+ )
148148 } ,
149149 whoami : async ( ) : Promise < WhoAmIOutput > => {
150150 try {
0 commit comments