Retrieves a policy by ID.
The getPolicy()
function returns a Promise that resolves to a policy whose ID matches the given ID.
function getPolicy(policyId: string): Promise<Policy>;
Policy ID.
import { policies } from "wix-events.v2";
// define policy ID
const policyId = "6933ddf1-26c7-46c3-9924-e78c833d6cca";
// get policy
async function getPolicy() {
try {
const result = await policies.getPolicy(policyId);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Returns a promise that resolves to
the policy.
{
"_id": "6933ddf1-26c7-46c3-9924-e78c833d6cca",
"revision": "1",
"_createdDate": "2023-03-07T13:18:09.185Z",
"_updatedDate": "2023-03-07T13:18:09.185Z",
"name": "Terms and Conditions Event 2",
"body": "<p>Nobody will be allowed admission to the Event without a valid ticket or pass.</p>",
"eventId": "3d3d5c04-ece0-45a8-85f0-11a58edaa192"
}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.