如何获得js-cookies?

我使用过redux,我想使用cookie项来获取我的API,如下所示:

import cookies from "js-cookies";

api/get_liste/${cookies.getItem("moncentre")}

when I run my app, ${cookies.getItem("moncentre")} is null and I get a warning:

A cookie associated with a cross-site resource at http://fontawesome.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

Such as my cdn of font awesome is : <script src="https://kit.fontawesome.com/a076d05399.js"></script>

我该如何解决?

评论