mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 19:06:40 -04:00
remove query-string from client side
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
import fetch from "cross-fetch";
|
import fetch from "cross-fetch";
|
||||||
import numeral from "numeral";
|
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
|
// don't continue if there isn't a span#meta-hits element on this page
|
||||||
const wrapper = document.getElementById("meta-hits");
|
const wrapper = document.getElementById("meta-hits");
|
||||||
@ -16,7 +15,7 @@ if (wrapper) {
|
|||||||
// strip beginning and ending forward slash
|
// strip beginning and ending forward slash
|
||||||
const slug = canonical.pathname.slice(1, -1);
|
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((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data.hits) {
|
if (data.hits) {
|
||||||
|
Reference in New Issue
Block a user