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

sign

上级 21d61454
......@@ -14,6 +14,7 @@
block
color="gray"
size="md"
@click="handleGetSignUrl('gitcode')"
>
<img src="~/assets/svg/logo-gitcode.svg" />
使用 GitCode 登录
......@@ -51,10 +52,18 @@
<script setup>
const emits = defineEmits(['close', 'signIn'])
const email = ref('')
const handleClose = () => {
function handleClose () {
emits('close')
}
const handleSign = () => {
function handleSign () {
emits('signIn')
}
async function handleGetSignUrl (type) {
let url
if (type === 'gitcode') {
const { data } = await useRequest('/v1/user/github/authorize_url')
url = data.value.data.url
}
window.location.href = url
}
</script>
......@@ -15,12 +15,11 @@ const request = async (url, options = {}) => {
error && console.error(error)
},
onResponse({ request, response, options }) {
// 处理响应数据
return response.data
},
onResponseError({ request, response, options }) {
// 处理响应错误
console.log('onResponseError ~ request:', request)
console.log('[ResponseError]', request)
}
}
......
......@@ -4,5 +4,5 @@
</div>
</template>
<script setup>
const { data } = await useFetch2('/api/mock/test')
const { data } = await useRequest('/api/mock/test')
</script>
\ No newline at end of file
......@@ -3,5 +3,5 @@
<div>{{ data }}</div>
</template>
<script setup>
const { data } = await useFetch2('/v1/chat/repository')
const { data } = await useRequest('/v1/chat/repository')
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册