diff --git a/service/content/content.ts b/service/content/content.ts index 7f5f8e48..7a47c35b 100644 --- a/service/content/content.ts +++ b/service/content/content.ts @@ -230,8 +230,5 @@ export async function deleteSPIT(id: any) { export async function postActivityLog(data: any) { const url = `activity`; - const headers = { - "content-type": "application/json", - }; - return httpPost(url, headers, data); + return httpPost(url, data); } diff --git a/service/http-config/http-base-service.ts b/service/http-config/http-base-service.ts index 3290e120..d161e680 100644 --- a/service/http-config/http-base-service.ts +++ b/service/http-config/http-base-service.ts @@ -4,7 +4,7 @@ import Cookies from "js-cookie"; import qs from "qs"; import { getCsrfToken } from "../auth"; -export async function httpPost(pathUrl: any, headers: any, data?: any) { +export async function httpPost(pathUrl: any, data?: any, headers?: any,) { const resCsrf = await getCsrfToken(); const csrfToken = resCsrf?.data?.token; const authToken = Cookies.get("access_token"); @@ -15,9 +15,9 @@ export async function httpPost(pathUrl: any, headers: any, data?: any) { const mergedHeaders = { ...defaultHeaders, - ...headers, ...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}), ...(authToken ? { "Authorization" : `Bearer ${authToken}`} : {}), + ...headers, }; const response = await axiosBaseInstance diff --git a/service/http-config/http-interceptor-service.ts b/service/http-config/http-interceptor-service.ts index 1df7c16d..460001bd 100644 --- a/service/http-config/http-interceptor-service.ts +++ b/service/http-config/http-interceptor-service.ts @@ -74,8 +74,8 @@ export async function httpPostInterceptor( }; const mergedHeaders = { ...defaultHeaders, - ...headers, ...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}), + ...headers, }; const response = await axiosInterceptorInstance @@ -115,8 +115,8 @@ export async function httpPutInterceptor( }; const mergedHeaders = { ...defaultHeaders, - ...headers, ...(csrfToken ? { "X-XSRF-TOKEN": csrfToken } : {}), + ...headers, }; const response = await axiosInterceptorInstance diff --git a/service/landing/landing.ts b/service/landing/landing.ts index 98a01328..ad50ed34 100644 --- a/service/landing/landing.ts +++ b/service/landing/landing.ts @@ -255,18 +255,12 @@ export async function getUserNotifications(page = 0, typeId: any) { export async function forgotPassword(username: any) { const url = `forgot-password?username=${username}`; - const header = { - "content-Type": "application/json", - }; - return httpPost(url, header); + return httpPost(url); } export async function saveUserReports(data: any) { const url = "public/users/reports"; - const header = { - "content-Type": "application/json", - }; - return httpPost(url, header); + return httpPostInterceptor(url, data); } export async function listCarousel() { diff --git a/service/login-services.ts b/service/login-services.ts index fa4a5281..68a81493 100644 --- a/service/login-services.ts +++ b/service/login-services.ts @@ -8,7 +8,7 @@ export async function login(data: any) { const headers = { "content-type": "application/json", }; - return await httpPost(pathUrl, headers, data); + return await httpPost(pathUrl, data, headers); } export async function userInfo(token: any) {