<template>
  <div id="app">
    <router-view  v-if="isRouterAlive"></router-view>
  </div>
</template>

<script>
import axios from 'axios'
import { getOrgs, changeOrg } from "@/api/config";
export default {
  name: "App",
  provide() {
    return {
      reload: this.reload
    };
  },
  data () {
    return {
      isRouterAlive: true,

      showErr: false,
      showWsErr: false,
    }
  },

  created(){

    // getOrgs().then(response => {
    //   if (response.data.state === 1) {
    //     var creator = response.data.data.creator;
    //     console.log("creator", creator);
    //     sessionStorage.setItem("org_id",creator.org_id);
    //     sessionStorage.setItem("admin_user_id",creator.admin_user_id);
    //     this.getToken(creator.org_id,creator.admin_user_id)
    //   }
    // });

  },
  methods: {
    reload () {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive = true
      })
    },

  },
  watch:{
  $route(to,from){
    
    if(to.path.indexOf('/patients/patient')== -1){
      window.sessionStorage.removeItem('patientKey')
    }
  }
},
};
</script>

<style>
body .el-table th.gutter {
  display: table-cell !important;
}
</style>
