Skip to content

Commit 09b8b7b

Browse files
Complete V1.1
1 parent 107b016 commit 09b8b7b

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/SwiftLink.Presentation/Controllers/LinkController.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ public async Task<IActionResult> Shorten([FromBody] GenerateShortCodeCommand com
1616
[HttpGet, Route("/api/{shortCode}")] //TODO: this routing should be removed.
1717
[ShortenEndpointFilter]
1818
public async Task<IActionResult> Shorten(string shortCode, [FromQuery] string password, CancellationToken cancellationToken = default)
19-
=> OK(await _mediarR.Send(new VisitShortenLinkQuery()
20-
{
21-
ShortCode = shortCode,
22-
Password = password,
23-
ClientMetaData = string.Empty
24-
}, cancellationToken));
19+
{
20+
var response = await _mediarR.Send(new VisitShortenLinkQuery()
21+
{
22+
ShortCode = shortCode,
23+
Password = password,
24+
ClientMetaData = string.Empty
25+
}, cancellationToken);
26+
27+
if (response.IsSuccess)
28+
return Redirect(response.Data);
29+
30+
return Ok(response);
31+
}
2532
}

0 commit comments

Comments
 (0)