refine imports and styles

This commit is contained in:
AceDataCloud committed 2023-01-25 12:28:56 +08:00
1 parent f538780b91
commit c9010effbb
47 files changed
+303 -337

No files matched your search

+9 -10
View File
@@ -1,9 +1,7 @@
<template>
<div></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { getCookie } from 'typescript-cookie';
import { getAuthBaseUrl, getDataBaseUrl } from '@/utils';
interface IData {
accessToken: string | undefined;
@@ -12,7 +10,7 @@ interface IData {
}
export default defineComponent({
name: 'Login',
name: 'AuthCallback',
data(): IData {
return {
accessToken: undefined,
@@ -30,15 +28,16 @@ export default defineComponent({
this.$router.push(this.redirect);
}
} else {
const host = window.location.host;
const subDomain = import.meta.env.DEV ? 'test.zhishuyun.com' : host.substring(host.indexOf('.') + 1);
console.debug('access token and refresh token not found, try to re-auth again');
const dataBaseUrl = getDataBaseUrl();
const authBaseUrl = getAuthBaseUrl();
// callback url used to init access token and then redirect back of `redirect`
const callbackUrl = `https://${host}/auth/callback?redirect=${this.redirect}`;
const targetUrl = `https://auth.${subDomain}?redirect=${callbackUrl}`;
const callbackUrl = `${dataBaseUrl}/auth/callback?redirect=${this.redirect}`;
// redirect to auth service to get access token then redirect back
const targetUrl = `${authBaseUrl}?redirect=${callbackUrl}`;
window.location.href = targetUrl;
}
},
methods: {}
}
});
</script>
+6 -17
View File
@@ -1,7 +1,5 @@
<template>
<div></div>
</template>
<script lang="ts">
import { getAuthBaseUrl, getDataBaseUrl } from '@/utils';
import { defineComponent } from 'vue';
interface IData {
@@ -9,30 +7,21 @@ interface IData {
}
export default defineComponent({
name: 'Login',
name: 'AuthLogin',
data(): IData {
return {
redirect: this.$route.query.redirect?.toString()
};
},
async mounted() {
const host = window.location.host;
const subDomain = import.meta.env.DEV ? 'test.zhishuyun.com' : host.substring(host.indexOf('.') + 1);
const dataBaseUrl = getDataBaseUrl();
const authBaseUrl = getAuthBaseUrl();
// callback url used to init access token and then redirect back of `redirect`
const callbackUrl = `https://${host}/auth/callback?redirect=${this.redirect}`;
const callbackUrl = `${dataBaseUrl}/auth/callback?redirect=${this.redirect}`;
// redirect to auth service to get access token then redirect back
const targetUrl = `https://auth.${subDomain}?redirect=${callbackUrl}`;
const targetUrl = `${authBaseUrl}?redirect=${callbackUrl}`;
window.location.href = targetUrl;
},
methods: {}
});
</script>
<style lang="scss" scoped>
.panel {
.title {
text-align: center;
font-size: 22px;
}
}
</style>