Send raw JSON.

This commit is contained in:
Mike Cao 2020-07-18 03:44:54 -07:00
parent 631d124a61
commit bb04015b46
3 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ export default function Layout({ title, children }) {
async
defer
data-website-id="865234ad-6a92-11e7-8846-b05adad3f099"
src="http://umami.is/umami.js"
src="/umami.js"
/>
)}
</Head>

View File

@ -62,7 +62,7 @@ export async function getCountry(req, ip) {
export async function parseSessionRequest(req) {
const ip = getIpAddress(req);
const { website_id, screen, language } = JSON.parse(req.body);
const { website_id, screen, language } = req.body;
const { userAgent, browser, os } = getDevice(req);
const country = await getCountry(req, ip);
const session_id = hash(`${website_id}${ip}${userAgent}${os}`);
@ -79,7 +79,7 @@ export async function parseSessionRequest(req) {
}
export function parseCollectRequest(req) {
const { type, payload } = JSON.parse(req.body);
const { type, payload } = req.body;
if (payload.session) {
const {

View File

@ -18,7 +18,7 @@ function post(url, params) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(params),
body: params,
}).then(res => res.json());
}