Commit 9632aad 1 parent 32c13d4 commit 9632aad Copy full SHA for 9632aad
File tree 1 file changed +20
-2
lines changed
1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 42
42
43
43
<script setup lang="ts">
44
44
import { OverlayScrollbarsComponent } from " #imports" ;
45
- const tokenData = useTokenData ();
46
45
const { width } = useWindowSize ();
47
46
48
- const { n } = useMagicKeys ();
47
+ const { n, o_i_d_c } = useMagicKeys ();
48
+ const tokenData = useTokenData ();
49
+ const client = useMegalodon (tokenData );
50
+ const providers = await useOAuthProviders ();
49
51
50
52
watchEffect (async () => {
51
53
if (n .value ) {
52
54
// Wait 50ms
53
55
await new Promise ((resolve ) => setTimeout (resolve , 50 ));
54
56
useEvent (" composer:open" );
55
57
}
58
+ if (o_i_d_c .value ) {
59
+ const response = await fetch (
60
+ new URL (
61
+ ` /oauth/link?issuer=${providers .value [0 ].id } ` ,
62
+ client .value ?.baseUrl ,
63
+ ),
64
+ {
65
+ headers: {
66
+ Authorization: ` Bearer ${tokenData .value ?.access_token } ` ,
67
+ },
68
+ },
69
+ );
70
+
71
+ const json = await response .json ();
72
+ window .location .href = json .link ;
73
+ }
56
74
});
57
75
</script >
You can’t perform that action at this time.
0 commit comments