updateAuthen
This commit is contained in:
parent
8f103aeb71
commit
02827aa02d
5 changed files with 63 additions and 21 deletions
30
src/views/auth.vue
Normal file
30
src/views/auth.vue
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
function setCookie(name: string, value: any, days: number) {
|
||||
let expires = ''
|
||||
if (days) {
|
||||
const date = new Date()
|
||||
date.setTime(date.getTime() + days * 24 * 60 * 55 * 1000)
|
||||
expires = '; expires=' + date.toUTCString()
|
||||
}
|
||||
document.cookie = name + '=' + (value || '') + expires + '; path=/'
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
console.log('query', route.query.token)
|
||||
console.log('accessToken', route.query.accessToken)
|
||||
|
||||
setCookie('BMAHRIS_KEYCLOAK_IDENTITY', route.query.token, 1)
|
||||
setCookie('BMAHRIS_KEYCLOAK_REFRESH', route.query.accessToken, 1)
|
||||
|
||||
window.location.href = '/'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue