From e7d71b35d334d8f4c0cbf3ca208616c68f81c838 Mon Sep 17 00:00:00 2001 From: ccbikai Date: Sun, 8 Dec 2024 14:44:03 +0800 Subject: [PATCH] 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 --- server/api/link/edit.put.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/api/link/edit.put.ts b/server/api/link/edit.put.ts index ca52465..2b05285 100644 --- a/server/api/link/edit.put.ts +++ b/server/api/link/edit.put.ts @@ -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 } } })