umwd-components 0.1.719 → 0.1.720

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- "use strict";var e=require("./get-token.js"),r=require("../../../node_modules/qs/lib/index.js"),t=require("../../lib/utils.js"),o=require("next/cache");const a=t.getStrapiURL(),n=r.default.stringify({populate:{customer_profile:{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:{populate:{vat_validate_response:!0,eori_validate_response:!0}},orders:{populate:{opo_items:{populate:{product:{populate:{price:!0,image:!0}}}}}},returns:{populate:{iro_items:{populate:{product:{populate:{price:!0,image:!0}}}}}}}}}}),s=r.default.stringify({populate:"role"});exports.getExtendedUserMeLoader=async function(){o.unstable_noStore();const r=new URL("/api/users/me",a);r.search=n;const t=await e.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const e=await fetch(r.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const o=await e.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(e){return console.error("getExtendedUserMeLoader Error:",e),{ok:!1,data:null,error:e}}},exports.getUserMeLoader=async function(e){const r=new URL("/api/users/me",a);r.search=n;try{const t=await fetch(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);if(t.ok)return t.json();throw new Error("Failed to fetch user details")}catch(e){return console.error("getUserMeLoader Error:",e),null}},exports.getUserRole=async function(){const r=new URL("/api/users/me",a);r.search=s;const t=await e.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const e=await fetch(r.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const o=await e.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(e){return console.error("getUserRole Error:",e),{ok:!1,data:null,error:e}}};
7
+ "use strict";var r=require("./get-token.js"),e=require("../../../node_modules/qs/lib/index.js"),t=require("../../lib/utils.js"),o=require("next/cache");const n=t.getStrapiURL(),a=e.default.stringify({}),s=e.default.stringify({populate:"role"});exports.getExtendedUserMeLoader=async function(){o.unstable_noStore();const e=new URL("/api/users/me",n);e.search=a;const t=await r.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const r=await fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(r){return console.error("getExtendedUserMeLoader Error:",r),{ok:!1,data:null,error:r}}},exports.getUserMeLoader=async function(r){const e=new URL("/api/users/me",n);e.search=a;try{const t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);if(t.ok)return t.json();throw new Error("Failed to fetch user details")}catch(r){return console.error("getUserMeLoader Error:",r),null}},exports.getUserRole=async function(){const e=new URL("/api/users/me",n);e.search=s;const t=await r.getAuthToken();if(!t)return{ok:!1,data:null,error:null};try{const r=await fetch(e.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},cache:"no-cache"});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);const o=await r.json();return o.error?{ok:!1,data:null,error:o.error}:{ok:!0,data:o,error:null}}catch(r){return console.error("getUserRole Error:",r),{ok:!1,data:null,error:r}}};