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

sign

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