feat: replace hardcoded free-access shop with API check
Loader now calls GET /free-access/:shop on the backend instead of comparing against a hardcoded shop domain. This lets the admin panel control which shops get free access without frontend deploys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6b46600fff
commit
ec2bbad4a2
@ -81,7 +81,15 @@ export const loader = async ({ request }) => {
|
|||||||
currencyCode: recurringPricing?.price?.currencyCode || "USD",
|
currencyCode: recurringPricing?.price?.currencyCode || "USD",
|
||||||
} : null;
|
} : null;
|
||||||
|
|
||||||
if (shop === "racewerksengg.myshopify.com") {
|
// Check server-side free-access whitelist
|
||||||
|
let hasFreeAccess = false;
|
||||||
|
try {
|
||||||
|
const far = await fetch(`https://backend.data4autos.com/free-access/${encodeURIComponent(shop)}`);
|
||||||
|
const fad = await far.json();
|
||||||
|
hasFreeAccess = fad.allowed === true;
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
if (hasFreeAccess) {
|
||||||
return json({ redirectToBilling: false, shop, isSubscribed: true, subscription: subscriptionDetails, allSubscriptions: subscriptions });
|
return json({ redirectToBilling: false, shop, isSubscribed: true, subscription: subscriptionDetails, allSubscriptions: subscriptions });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user