import { StatusCode } from './constants' ; param threadId param userId param displayName export const joinThread = async ( threadId , userId , displayName ) : Promise < boolean > => { try { const requestOptions = { method : 'POST' , headers : { 'Content-Type' : 'application/json' } , body : JSON . stringify ( { Id : userId , DisplayName : displayName } ) } ; const response = await fetch ( `/addUser/${ threadId }` , requestOptions ) ; if ( response . status === StatusCode . CREATED ) { return true ; } } catch ( error ) { console . error ( 'Failed at adding user, Error: ' , error ) ; } return false ; } ;