Jelajahi Sumber

get the authorization code from callback url

Olivier Massot 2 bulan lalu
induk
melakukan
edc90cda15
1 mengubah file dengan 11 tambahan dan 1 penghapusan
  1. 11 1
      pages/helloasso.vue

+ 11 - 1
pages/helloasso.vue

@@ -41,6 +41,8 @@
 import { useEntityFetch } from '~/composables/data/useEntityFetch'
 import AuthUrl from '~/models/Custom/HelloAsso/AuthUrl'
 
+const route: RouteLocationNormalizedLoaded = useRoute()
+
 const { fetch } = useEntityFetch()
 
 const { data: authUrl, status } = fetch(AuthUrl)
@@ -51,11 +53,19 @@ const onHelloAssoConnectClicked = () => {
   if (status.value !== 'success') {
     console.log('still pending')
   } else {
-    console.log(authUrl)
     showDialog.value = true
     navigateTo(authUrl.value!.authUrl, { external: true })
   }
 }
+
+const authorizationCode: Ref<string | null> = ref(null)
+
+if (route.query.code) {
+  authorizationCode.value = route.query.code as string
+}
+
+
+
 </script>
 
 <style scoped lang="scss">