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

remove query-string from client side

This commit is contained in:
2021-07-09 15:03:27 -04:00
parent 574c64bae2
commit d24f55d7ac

View File

@ -1,6 +1,5 @@
import fetch from "cross-fetch";
import numeral from "numeral";
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");
@ -16,7 +15,7 @@ if (wrapper) {
// strip beginning and ending forward slash
const slug = canonical.pathname.slice(1, -1);
fetch(queryString.stringifyUrl({ url: "/api/hits/", query: { slug: slug } }))
fetch(`/api/hits/?slug=${encodeURIComponent(slug)}`)
.then((response) => response.json())
.then((data) => {
if (data.hits) {