/**
 * front connect to keycloak
 */
import Keycloak from "keycloak-js";
// import config from "../app.config";
// import http from "../shared/http";
// import router from "../router";

const initOptions = {
  //   url: "https://keycloak.frappet.synology.me/auth/",
  realm: "bma-ehr",
  clientId: "bma-ehr-vue3",
  url: "https://id.frappet.synology.me/",
  //   realm: "bma-ehr-exam",
  //   clientId: "bma-ehr-exam-vue3",
}; //option keycloak ที่จะ connect

const keycloak = Keycloak(initOptions);

keycloak.onAuthSuccess = () => {}; //เพิ่มlogin สำเร็จจะมาทำฟังก์ชันนี้

await keycloak.init({ onLoad: "check-sso", checkLoginIframe: false }); //ทำการ connect keycloak
export default keycloak;
