https://avatars.dicebear.com/v2/avataaars/{{username}}.svg?options[mood][]=happy The {{username}} in the URL is the placeholder for the user's username. It should be dynamically replaced by the username received from the user’s API endpoint. For example, if the username for one of the users is psamd then the URL for the avatar for this user will be: https://avatars.dicebear.com/v2/avataaars/psamd.svg?options[mood][]=happy
You could do a string replace:
const url = "https://avatars.dicebear.com/v2/avataaars/{{username}}.svg?options[mood][]=happy"
const username = "UserA"
const newUrl = url.replace("{{username}}", username)
console.log(newUrl)
// https://avatars.dicebear.com/v2/avataaars/UserA.svg?options[mood][]=happy