diff --git a/services/activity-log.ts b/services/activity-log.ts index 3f685c8..fac89e5 100644 --- a/services/activity-log.ts +++ b/services/activity-log.ts @@ -1,5 +1,8 @@ import { PaginationRequest } from "@/types/globals"; import { httpGet, httpPost, httpPut } from "./http-config/axios-base-service"; +import Cookies from "js-cookie"; + +const token = Cookies.get("access_token"); export async function saveActivity(data: any, token?: string) { const headers = token @@ -22,7 +25,10 @@ export async function getActivity() { export async function getVisitorLog(data: any) { const { page, limit, startDate, endDate } = data; - const headers = { "content-type": "application/json" }; + const headers = { + "content-type": "application/json", + Authorization: `Bearer ${token}`, + }; const pathUrl = `/activity-logs?purpose=visitor-summary&page=${ page || 0 }&limit=${limit || 10}&startDate=${startDate || ""}&endDate=${endDate || ""}`; diff --git a/services/article.ts b/services/article.ts index 92afb53..7b96808 100644 --- a/services/article.ts +++ b/services/article.ts @@ -220,7 +220,7 @@ export async function getUserLevelDataStat( export async function getStatisticForMaps(startDate: string, endDate: string) { const headers = { "content-type": "application/json", - // Authorization: `Bearer ${token}`, + Authorization: `Bearer ${token}`, }; return await httpGet( `/activity-logs/visitors-by-region-stats?startDate=${startDate}&endDate=${endDate}`, @@ -234,7 +234,7 @@ export async function getStatisticVisitorsBrowser( ) { const headers = { "content-type": "application/json", - // Authorization: `Bearer ${token}`, + Authorization: `Bearer ${token}`, }; return await httpGet( `/activity-logs/visitors-by-browser-stats?startDate=${startDate}&endDate=${endDate}`,