mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-03 07:46:18 +00:00
OIDC should be good to go
This commit is contained in:
@@ -21,13 +21,22 @@ const initApp = () => {
|
||||
app.mount("#app")
|
||||
}
|
||||
|
||||
function removeSearchString() {
|
||||
let url = new URL(window.location.href);
|
||||
url.search = ''; // Remove all query parameters
|
||||
history.replaceState({}, document.title, url.toString());
|
||||
}
|
||||
|
||||
if (state && code){
|
||||
axiosPost("/api/signin/oidc", {
|
||||
provider: state,
|
||||
code: code,
|
||||
redirect_uri: window.location.protocol + '//' + window.location.host + window.location.pathname
|
||||
}).then(data => {
|
||||
window.location.search = ''
|
||||
let url = new URL(window.location.href);
|
||||
url.search = '';
|
||||
history.replaceState({}, document.title, url.toString());
|
||||
|
||||
initApp()
|
||||
if (!data.status){
|
||||
const store = clientStore()
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<script setup async>
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
import {axiosGet} from "@/utilities/request.js";
|
||||
import {axiosGet, requestURl} from "@/utilities/request.js";
|
||||
import {clientStore} from "@/stores/clientStore.js";
|
||||
import Configuration from "@/components/Configuration/configuration.vue";
|
||||
import {onBeforeRouteLeave} from "vue-router";
|
||||
import {onBeforeRouteLeave, useRouter} from "vue-router";
|
||||
import axios from "axios";
|
||||
const store = clientStore()
|
||||
const loading = ref(true)
|
||||
|
||||
@@ -23,7 +24,20 @@ onMounted(async () => {
|
||||
|
||||
onBeforeRouteLeave(() => {
|
||||
clearInterval(refreshInterval.value)
|
||||
})
|
||||
});
|
||||
const router = useRouter()
|
||||
const signingOut = ref(false)
|
||||
const signOut = async () => {
|
||||
clearInterval(refreshInterval.value)
|
||||
signingOut.value = true;
|
||||
await axios.get(requestURl('/api/signout')).then(() => {
|
||||
router.push('/signin')
|
||||
}).catch(() => {
|
||||
router.push('/signin')
|
||||
});
|
||||
store.newNotification("Sign out successful", "success")
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -37,10 +51,14 @@ onBeforeRouteLeave(() => {
|
||||
<i class="bi bi-gear-fill me-sm-2"></i>
|
||||
<span>Settings</span>
|
||||
</RouterLink>
|
||||
<RouterLink to="/signout" class="btn btn-outline-danger rounded-3 btn-sm" aria-current="page">
|
||||
<a role="button" @click="signOut()" class="btn btn-outline-danger rounded-3 btn-sm"
|
||||
:class="{disabled: signingOut}"
|
||||
aria-current="page">
|
||||
<i class="bi bi-box-arrow-left me-sm-2"></i>
|
||||
<span>Sign Out</span>
|
||||
</RouterLink>
|
||||
<span>
|
||||
{{ signingOut ? 'Signing out...':'Sign Out'}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user