From b9eae520fa1a56be9df136cf5368b6646bb8815c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geir=20G=C3=A5sodden?= Date: Sat, 1 Jan 2022 09:26:51 +0100 Subject: [PATCH] Adds hostnam to card (patch) --- pages/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/index.js b/pages/index.js index e3a19b6..82b9075 100644 --- a/pages/index.js +++ b/pages/index.js @@ -12,6 +12,11 @@ function fixUrl(url) { return url } +function getHostname (url) { + const address = new URL(url) + return address.hostname +} + const Header = () => ( Webkvalitet @@ -30,7 +35,7 @@ export default function Home() { setIsLoading(true) setData(null) const result = await webquality(url) - setData([{ name : url, id: 'webkvalitet', date: new Date(), result }]) + setData([{ name : getHostname(url), id: 'webkvalitet', date: new Date(), result }]) setIsLoading(false) }