Hello everyone, I’m new to the community and I’m not understanding what I’m doing wrong to generate a request for my own server.
I’m doing a registration validation where the person receives an email with a link to my app’s page passing two parameters in the URL iduser and keyuser.
When the user clicks on a button I send a request to my server to validate if the key is valid, but when sending the request it always returns this error.
Here’s the code and if anyone can help I don’t understand the reason for the error.
import wixLocation from ‘wix-location’ ; import { fetch } from ‘wix-fetch’ ;
…
export function button35_click ( event ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
let query = wixLocation . query ;
const iduser = query . iduser ;
const keyuser = query . keyuser ;
//const url = `http://bravussistemas.ddns.com.br:8888/DataSnap/Rest/TReleaseController/NovoUsuarioAPP/${iduser}/${keyuser}`;
**const** url = `http://bravussistemas.ddns.com.br:8888/DataSnap/Rest/TReleaseController/NovoUsuarioAPP/30254/df4b1fd7704413b50a6d6f90dc05a0b0e322d2c42c3069c5bb9b7729ec2f5a9c` ;
// faz uma solicitação HTTP para a API usando fetch()
fetch ( url , { "method" : "get" })
. then ( httpResponse => {
**return** httpResponse . json ()
})
. then ( json => {
// verifica o resultado da API e exibe uma mensagem ao usuário com base no resultado
console . log ( json . result );
**if** ( json . result == **true** ) {
$w ( "#box1" ). show ();
$w ( "#box2" ). hide ();
} **else** {
$w ( "#box1" ). hide ();
$w ( "#box2" ). show ();
}
})
. **catch** ( error => {
console . error ( "Erro ao buscar dados da API:" , error );
$w ( "#box1" ). hide ();
$w ( "#box2" ). show ();
});
}