@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 882 B
JavaScript
import e from"../../../constants/constants.mjs";import t from"../../../services/auth/get-status.mjs";import{runToolkitService as n}from"../utils.mjs";const r=async e=>{e&&await Promise.all([e.set(`Cache-Control`,`private, no-store`),e.set(`Pragma`,`no-cache`)])},i=async(i,a)=>n(async()=>{await r(a.headers);let[n,o]=await Promise.all([a.cookies.get(e.cookies.accessToken),a.cookies.get(e.cookies.refreshToken)]),s=await t(i,{accessToken:n??void 0,refreshToken:o??void 0});return s.error?s.error.type===`authorisation`?{error:void 0,data:{authenticated:!1}}:s:{error:void 0,data:{authenticated:!0}}},{name:{key:`core.toolkit.auth.status.error.name`,defaultMessage:`Authentication Toolkit Error`},message:{key:`core.toolkit.auth.status.error.message`,defaultMessage:`Lucid toolkit could not resolve authentication status.`}});export{i as default};
//# sourceMappingURL=status.mjs.map