提交 f78a0066 编写于 作者: View Design's avatar View Design

sign

上级 80b20543
......@@ -15,6 +15,7 @@
color="gray"
size="md"
@click="handleGetSignUrl('gitcode')"
disabled
>
<img src="~/assets/svg/logo-gitcode.svg" />
使用 GitCode 登录
......@@ -25,6 +26,7 @@
label="使用 Google 登录"
color="gray"
size="md"
disabled
/>
<UButton
block
......@@ -32,6 +34,7 @@
label="使用 GitHub 登录"
color="gray"
size="md"
@click="handleGetSignUrl('github')"
/>
<UDivider label="或" />
<UInput
......@@ -58,9 +61,9 @@ function handleClose () {
function handleSign () {
emits('signIn')
}
async function handleGetSignUrl (type) {
async function handleGetSignUrl (source) {
let url
if (type === 'gitcode') {
if (source === 'github') {
const { data } = await useRequest('/v1/user/github/authorize_url')
url = data.value.data.url
}
......
......@@ -23,7 +23,7 @@ const request = async (url, options = {}) => {
}
}
return await useFetch(fullUrl, config)
return await useFetch(fullUrl, Object.assign(config, options))
}
export default request
......@@ -5,4 +5,17 @@
definePageMeta({
layout: 'empty'
})
const route = useRoute()
const state = reactive({
source: route.query.source || '',
code: route.query.code || ''
})
const { data } = await useRequest('/v1/user/github/login', {
query: { code: state.code },
server: false
})
console.log(data.value)
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册