$(document).ready(function () {
  // Place JavaScript code here.
  $("#login-btn").click(function () {
    let account = $("#login-mobile").val();
    let password = $("#login-pwd").val();
    if (account && password) {
      postAjaxRequst(
        "/api/Check/Login",
        { account: account, password: password, appKey: "openauth" },
        function (res) {
          if (res.code == 200) {
            toastr.success(res.message);
            localStorage.setItem("token", res.token);
            setTimeout(function () {
              window.location.href = "index.html";
            }, 1000);
          } else {
            toastr.error(res.message);
          }
        }
      );
    } else {
      alert("Please fill all the fields");
    }
  });
});
