Files
supabase/packages/common/fetchWrappers.tsx
T
Joshen Lim ed207751ad Update telemetry calls for docs to support PH (#29749)
* Update telemetry calls for docs to support PH

* Update telemetry calls for www to support PH

* Add ts ignore

* Remove use of useRouter for docs

* Add credentials include for www and docs for telemetry calls

* Update TELEMETRY_CONSENT in common for www and docs to reset telemetry opt in preference

* Update common telemetry to use new endpoint and payload, and trigger reset request when opting out of telemetry from ui patterns PrigacySettings

* Fix

* Fix

* Fix

* Fix build issue in docs

* Fix build issue in docs

* I hope this fixes the build issues

* once more...

* Fix

* Add credentials include

* Fix
2024-10-16 15:16:33 +08:00

22 lines
580 B
TypeScript

interface DataProps {
[prop: string]: any
}
export const post = (url: string, data: DataProps, options = {} as { [key: string]: any }) => {
const { optionHeaders, ...otherOptions } = options
return fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
...optionHeaders,
},
credentials: 'include',
referrerPolicy: 'no-referrer-when-downgrade',
body: JSON.stringify(data),
...otherOptions,
}).catch((error) => {
console.error('Error at fetchWrapper - post:', error)
})
}