Hello,
I have issues with hooks, both beforinsert and afterinsert
I have written the following code for the 2 functions and for each I got the same error in the web inspector
Wix code SDK error: The url parameter that is passed to the to method cannot be set to the value . It must be of type string.
I have searched for many hours on the web to find explanation but I didn’t find anything corresponding to my case
here is the code :
import wixLocation from 'wix-location'; // In data.js export function Cotation_beforeInsert(item, context) { //TODO: write your code here... if (item.pays === "" ) { item.pays = "France" } return item; } export function Cotation_afterInsert(item, context) { //TODO: write your code here... let hookContext = context; // see below // some changes to the received item if (item.numero_adherent === "" ) { wixLocation.to("/paiement-adhesion") } else if (item.numero_adherent === '0') { wixLocation.to("/paiement-adhesion") } return item; }
Alain:
I just ran into this same problem with data I am trying to pull from a collection and put it into a repeater. Did you ever find a way to convert the "value" to a type string?
- Garrett