Skip to content

Commit

Permalink
Remove i18n dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Jul 2, 2024
1 parent 079150a commit db3b4f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
],
];

wp_interactivity_state( 'booking-form', [
'title' => __( 'Booking Form Submission', 'booking-form' );
]);

?>

<div
Expand Down
10 changes: 3 additions & 7 deletions src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import { store, getContext } from '@wordpress/interactivity';
/**
* Non-module dependencies
*/
const {
apiFetch,
i18n: { __ },
} = wp;
const { apiFetch } = wp;

const { actions } = store( 'booking-form', {
const { state, actions } = store( 'booking-form', {
actions: {
next( e ) {
e.preventDefault();
Expand Down Expand Up @@ -52,7 +49,6 @@ const { actions } = store( 'booking-form', {
const context = getContext();
context.submitting = true;

const title = __( 'Booking Form Submission', 'booking-form' );
const content = actions.reviewFields().reduce( ( acc, field ) => {
return `${ acc }<p><strong>${ field.label }</strong>: ${ field.value }</p>`;
}, '' );
Expand All @@ -62,7 +58,7 @@ const { actions } = store( 'booking-form', {
path: '/booking-form/v1/booking',
method: 'POST',
data: {
title,
title: state.title,
content,
},
} );
Expand Down

0 comments on commit db3b4f2

Please sign in to comment.