feat: add short link to edit link response

Enhances link edit endpoint by including a fully-qualified short link URL in the response, constructed from request protocol and host alongside the slug
This commit is contained in:
ccbikai 2024-12-08 14:44:03 +08:00
parent 337f8f174c
commit e7d71b35d3

View file

@ -30,6 +30,7 @@ export default eventHandler(async (event) => {
},
})
setResponseStatus(event, 201)
return { link: newLink }
const shortLink = `${getRequestProtocol(event)}://${getRequestHost(event)}/${link.slug}`
return { link: newLink, shortLink }
}
})