32 lines
696 B
Vue
32 lines
696 B
Vue
<template>
|
|
<div>
|
|
<h1>This is an login page</h1>
|
|
<p>
|
|
{{ $route.query.code }}
|
|
</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import axios from 'axios'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { onMounted } from 'vue'
|
|
import { useCounterStore } from '../stores/counter'
|
|
|
|
const counterStore = useCounterStore()
|
|
const route = useRoute()
|
|
const router = useRouter()
|
|
|
|
onMounted(() => {
|
|
const code = route.query.code
|
|
if (route.query.code) {
|
|
axios.post('http://localhost:8080/login', { code }).then((resp) => {
|
|
if (resp.data.code == '2000000') {
|
|
counterStore.setUserInfo(resp.data.data)
|
|
router.push('/')
|
|
}
|
|
})
|
|
}
|
|
})
|
|
</script>
|