Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active March 30, 2025 00:13

Revisions

  1. wplit revised this gist Mar 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.js
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ request: function (e, t) {



    // Return original request if no body, would solve
    // Possible solution, returns original request if no body
    request: function (e, t) {
    if (t && t.body) {
    const { body: n } = t;
  2. wplit revised this gist Mar 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    /* current code */
    /* current code, fails when fails when t.body is undefined */
    request: function (e, t) {
    const { body: n } = t; // This fails when t.body is undefined
    r = JSON.parse(n);
  3. wplit revised this gist Mar 30, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion code.js
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ request: function (e, t) {



    // Return original request if no body
    // Return original request if no body, would solve
    request: function (e, t) {
    if (t && t.body) {
    const { body: n } = t;
  4. wplit revised this gist Mar 30, 2025. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions code.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,18 @@
    /* current code */
    request: function (e, t) {
    const { body: n } = t; // This fails when t.body is undefined
    r = JSON.parse(n);
    return "bricks_render_element" === r?.action && r?.element && (m(r.element), E(r.element.id)), [e, t];
    }



    // Return original request if no body
    request: function (e, t) {
    if (t && t.body) {
    const { body: n } = t;
    r = JSON.parse(n);
    return "bricks_render_element" === r?.action && r?.element && (m(r.element), E(r.element.id)), [e, t];
    }
    return [e, t];
    }
  5. wplit revised this gist Mar 30, 2025. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion code.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    request: function (e, t) {
    const { body: n } = t; // This fails when t.body is undefined
    r = JSON.parse(n);
  6. wplit created this gist Mar 30, 2025.
    6 changes: 6 additions & 0 deletions code.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@

    request: function (e, t) {
    const { body: n } = t; // This fails when t.body is undefined
    r = JSON.parse(n);
    return "bricks_render_element" === r?.action && r?.element && (m(r.element), E(r.element.id)), [e, t];
    }