if you want to create just a simple log-in-form to an external site, then all you need are just 2-inputfields and a little code with an if-query + location-function.
Importing APIs
import wixLocation from 'wix-location';
Starting the “logIn_toExternalSite” - function.
export function myButton_click(event) { } // button-event
Your function “logIn_toExternalSite”
function logIn_toExternalSite() { } // your starting function
You should use the wix-fetch API to post to the endpoint.
import {fetch} from 'wix-fetch';
let email = $w('#email').value // Your email input element
let pass = $w('#pass').value // Your password input element
let url = "https://triunfoeventos.siefor.net.br/sistema/alu/logadm.php";
let options = {
method: post,
headers: { "Content-Type": "application/json" },
body: {
email: email,
password: pass
}
}
return fetch(url, options).then( (httpResponse) => {
if (httpResponse.ok) {
let result = httpResponse.json();
return result;
} else {
// handle the case where the response wasn't accepted
Promise.reject("Bad request");
}
}).catch(err => {
// handle the case where the fetch failed!
Promise.reject("fetch faild!");
})