1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 18:46:40 -04:00

harder/better/faster/stronger deps

This commit is contained in:
2021-07-07 09:34:57 -04:00
parent dd0a2b01d2
commit 0adf03d969
7 changed files with 306 additions and 298 deletions

View File

@ -1,4 +1,5 @@
import fetch from "cross-fetch";
import * as queryString from "query-string";
// don't continue if there isn't a span#meta-hits element on this page
const wrapper = document.getElementById("meta-hits");
@ -14,7 +15,7 @@ if (wrapper) {
// strip beginning and ending forward slash
const slug = canonical.pathname.slice(1, -1);
fetch("/api/hits/?slug=" + slug)
fetch(queryString.stringifyUrl({ url: "/api/hits/", query: { slug: slug } }))
.then((response) => response.json())
.then((data) => {
if (typeof data.hits !== "undefined") {