0

<Get resource="/me/photo/$value" scopes={['user.read']} maxPages={2} type='image'> // Type '"image"' is not assignable to type 'ResponseType | undefined'. <MyPhoto template="value> When i try to specify the type in the Get this what i get, with out that templateprops are empty

const MyMessage = (Props: MgtTemplateProps)=>{ const photo=Props.dataContext; /// this is empty return(<></>) }

error: Type '"image"' is not assignable to type 'ResponseType | undefined' how to retrieve the image url by using URL.createObjectURL

1 Answers1

0

You should be using the type ResponseType to identify you want an image and use the default template instead of the value as it's not an array.. This is how I've been doing it :

<Get resource="/me/photo/$value" type={ResponseType.image}>
    <MyPhoto template='default' />
</Get> 

And the MyPhoto component should be the following :

const MyPhoto = (props: MgtTemplateProps) => {
  const { image } = props.dataContext;
  return <img src={image} />;
};