PluginProbe
WPZOOM Forms – Drag & Drop Contact Form Builder for WordPress / trunk
WPZOOM Forms – Drag & Drop Contact Form Builder for WordPress vtrunk
2.0.9 2.0.8 2.0.7 2.0.6 2.0.5 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 All 43 releases
wpzoom-forms / src / builder / api.js

api.js in WPZOOM Forms – Drag & Drop Contact Form Builder for WordPress trunk, at src/builder/api.js

20 lines 992 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import apiFetch from '@wordpress/api-fetch';
2
3 const cfg = window.wpzfBuilder || {};
4
5 apiFetch.use( apiFetch.createNonceMiddleware( cfg.nonce || '' ) );
6 apiFetch.use( apiFetch.createRootURLMiddleware( cfg.apiRoot ? cfg.apiRoot.replace( /\/wpzf\/v1$/, '/' ) : '/wp-json/' ) );
7
8 const base = '/wpzf/v1';
9
10 export const api = {
11 getForm: ( id ) => apiFetch( { path: `${ base }/forms/${ id }` } ),
12 listForms: () => apiFetch( { path: `${ base }/forms` } ),
13 createForm: ( opts = {} ) => apiFetch( { path: `${ base }/forms`, method: 'POST', data: opts } ),
14 updateForm: ( id, payload ) => apiFetch( { path: `${ base }/forms/${ id }`, method: 'PUT', data: payload } ),
15 deleteForm: ( id ) => apiFetch( { path: `${ base }/forms/${ id }`, method: 'DELETE' } ),
16 duplicateForm: ( id ) => apiFetch( { path: `${ base }/forms/${ id }/duplicate`, method: 'POST' } ),
17 getTemplates: () => apiFetch( { path: `${ base }/templates` } ),
18 getOptionLists: () => apiFetch( { path: `${ base }/option-lists` } ),
19 };
20