Created (with help) an event handler that works great in the Editor. Updates First Secret in the Secrets Manager.
Published version fails. Looks like a POST error of some kind? Possibly related to not being a passive event handler? This one’s a real mystery to me. Can send more Google F12 info if that helps.
import { updateUserValue } from ‘backend/events.jsw’
$w . onReady ( function () {
$w ( ‘#button99’ ). onClick (( event ) => {
updateUserValue($w ( ‘#usertext99’ ). value );
});
});
jsw code:
import wixSecretsBackend from ‘wix-secrets-backend’ ;
export function updateUserValue ( twitterHandle ) {
const id = “8ce0b5b9-6dcb-462a-b8d8-49ef15297f34” ;
const secret = {
value : twitterHandle ,
};
**return** wixSecretsBackend . updateSecret ( id , secret )
. then (() => {
console . log ( "Science, b*tch!" );
})
. **catch** (( error ) => {
console . error ( error );
})
}
How would I add { passive : true } to the event handler with the Velo syntax? It’s not in the docs and .addEventListener ends up undefined I suspect because of $w namespace.
Any ideas greatly appreciated!