Removes the current policy from the visitor's browser and resets the visitor's consent policy to the default policy for the site.
The resetConsentPolicy()
function returns a Promise that resolves when the policy is reset.
function resetConsentPolicy(): Promise<void>;
import { createClient } from "@wix/sdk";
import { site } from "@wix/site";
import { consentPolicy } from "@wix/site-window";
const wixClient = createClient({
host: site.host(),
modules: { consentPolicy },
});
// ...
(async () => {
try {
const policy = await wixClient.consentPolicy.resetConsentPolicy();
console.log("The policy is now set to the default site policy.");
return policy;
} catch (error) {
console.error(error);
}
})();
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.