File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import type {
1212
1313export function useStripeProvider ( ) {
1414 const { fetch } = useCustomFetch ( )
15+ const { tokenCsrf } = useCsrfStore ( )
16+
1517 const { promoCode } = usePromoCode ( )
1618 const { public : { stripeBaseUrl } } = useRuntimeConfig ( )
1719
@@ -45,6 +47,9 @@ export function useStripeProvider() {
4547 {
4648 baseURL : stripeBaseUrl ,
4749 body : JSON . stringify ( { returnURL : window . location . href } ) ,
50+ headers : {
51+ 'x-csrf-token' : tokenCsrf . value ,
52+ } ,
4853 } ,
4954 )
5055
@@ -69,6 +74,9 @@ export function useStripeProvider() {
6974 priceId,
7075 promotionCode : promoCode ,
7176 } ) ,
77+ headers : {
78+ 'x-csrf-token' : tokenCsrf . value ,
79+ } ,
7280 } ,
7381 )
7482
Original file line number Diff line number Diff line change @@ -27,6 +27,16 @@ const scrollToAddons = () => {
2727 const element = document .getElementById (' addons' )
2828 element ?.scrollIntoView ({ behavior: ' smooth' })
2929}
30+
31+ const { setTokenCsrf } = useCsrfStore ()
32+ callOnce (async () => await $fetch (' https://v2-staging-hoodi-dev.beaconcha.in/api/i/pricing' , {
33+ onResponse({
34+ response ,
35+ }) {
36+ const token = response .headers .get (' x-csrf-token' ) ?? ' '
37+ setTokenCsrf (token )
38+ },
39+ }))
3040 </script >
3141
3242<template >
You can’t perform that action at this time.
0 commit comments