Skip to content

Commit

Permalink
feat: cookie scripts refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
abocsan-plenty committed Dec 7, 2023
1 parent a85b007 commit 12b30eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions apps/web/cookie-scripts.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { cartGetters } from '@plentymarkets/shop-sdk';

const loadPaypalScript = async () => {
const { loadScript } = usePayPal();
const { data: cart } = useCart();

const currency = computed(() => cartGetters.getCurrency(cart.value) || (useAppConfig().fallbackCurrency as string));
const paypal = await loadScript(currency.value);

console.log('works: ', paypal);
const loadExampleScript = async () => {
// eslint-disable-next-line no-console
console.log('This is an example.');
};

export default {
loadPaypalScript,
loadExampleScript,
};
2 changes: 1 addition & 1 deletion apps/web/cookie.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
Status: 'Example cookie that loads a hello world script if accepted.',
PrivacyPolicy: '/PrivacyPolicy',
Lifespan: 'Session',
script: ['loadPaypalScript'],
script: ['loadExampleScript'],
},
],
},
Expand Down

0 comments on commit 12b30eb

Please sign in to comment.