From a88c77cc9a3070921e41695f068c01b76f5b4909 Mon Sep 17 00:00:00 2001 From: mh-zeynal Date: Sun, 26 Nov 2023 10:18:03 +0330 Subject: [PATCH] chore: add token to cart request --- frontend/src/providers/APIProvider/APIProvider.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/providers/APIProvider/APIProvider.jsx b/frontend/src/providers/APIProvider/APIProvider.jsx index 66c4481..dad3117 100644 --- a/frontend/src/providers/APIProvider/APIProvider.jsx +++ b/frontend/src/providers/APIProvider/APIProvider.jsx @@ -125,8 +125,9 @@ export function APIProvider({children}) { } console.log(body) + const tokenStr = JSON.parse(localStorage.getItem('user'))['access'] await service.post(`${URL.baseURL}${URL.services.default}${endpoint}`, - body) + body, {headers: {"Authorization" : `Bearer ${tokenStr}`}}) .then(response => { setAddToCartResponse(response) })