add verification check and support
This commit is contained in:
1 parent
538dfd283e
commit
91c6792c5c
10 files changed
+90
-16
No files matched your search
@@ -13,8 +13,8 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<div v-if="itemKey === 'api_key'">
|
||||
<div v-if="!isApplied">
|
||||
<el-popover placement="bottom" :width="200" trigger="click">
|
||||
<div v-if="!applied === true">
|
||||
<el-popover placement="bottom" :width="200" :visible="applied === false">
|
||||
<p class="text-center mb-2">
|
||||
<small>{{ $t('application.message.notApplied') }}</small>
|
||||
</p>
|
||||
@@ -26,7 +26,6 @@
|
||||
v-model="value[itemKey?.toString()]"
|
||||
:placeholder="$t('common.title.placeholderOfInput')"
|
||||
class="inline-block w-4/5"
|
||||
@focus="$emit('refresh-applications')"
|
||||
/>
|
||||
</template>
|
||||
</el-popover>
|
||||
@@ -81,7 +80,8 @@ import { ISchema } from '@/operators/api/models';
|
||||
import { applicationOperator, IApi, IApplication, IApplicationType } from '@/operators';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import { ElPopover, ElInput, ElSelect, ElButton, ElTooltip, ElOption, ElMessage } from 'element-plus';
|
||||
import { ERROR_CODE_DUPLICATION } from '@/constants/errorCode';
|
||||
import { ERROR_CODE_DUPLICATION, ERROR_CODE_UNVERIFIED } from '@/constants/errorCode';
|
||||
import { getVerificationUrl } from '@/utils';
|
||||
|
||||
interface IData {
|
||||
value: {
|
||||
@@ -112,6 +112,10 @@ export default defineComponent({
|
||||
applications: {
|
||||
type: Array as () => IApplication[],
|
||||
required: true
|
||||
},
|
||||
applied: {
|
||||
type: Boolean,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
emits: ['update:form', 'refresh-applications'],
|
||||
@@ -121,9 +125,6 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isApplied() {
|
||||
return this.applications.filter((application) => application.api?.id === this.api?.id).length > 0;
|
||||
},
|
||||
appliedApplication(): IApplication | undefined {
|
||||
const applications = this.applications.filter((application) => application.api?.id === this.api?.id);
|
||||
if (applications.length > 0) {
|
||||
@@ -160,6 +161,17 @@ export default defineComponent({
|
||||
if (error?.response?.data?.code === ERROR_CODE_DUPLICATION) {
|
||||
ElMessage.error(this.$t('application.message.alreadyApplied'));
|
||||
}
|
||||
if (error?.response?.data?.code === ERROR_CODE_UNVERIFIED) {
|
||||
ElMessage({
|
||||
dangerouslyUseHTMLString: true,
|
||||
duration: 0,
|
||||
showClose: true,
|
||||
message: `${this.$t(
|
||||
'application.message.unverified'
|
||||
)} <a class="underline" href="${getVerificationUrl()}">${this.$t('application.message.goVerify')}</a>`,
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
v-model:form="formValue.queries"
|
||||
:schema="api?.request?.queries"
|
||||
:api="api"
|
||||
:applied="applied"
|
||||
:applications="applications"
|
||||
@refresh-applications="getApplications"
|
||||
/>
|
||||
@@ -45,6 +46,7 @@ import ApiInfo from './Info.vue';
|
||||
export interface IData {
|
||||
formValue: IForm;
|
||||
applications: IApplication[];
|
||||
applied: boolean | undefined;
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
@@ -69,7 +71,8 @@ export default defineComponent({
|
||||
data(): IData {
|
||||
return {
|
||||
formValue: this.form || {},
|
||||
applications: []
|
||||
applications: [],
|
||||
applied: undefined
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -89,6 +92,7 @@ export default defineComponent({
|
||||
})
|
||||
.then(({ data: data }: { data: IApplicationListResponse }) => {
|
||||
this.applications = data.items;
|
||||
this.applied = this.applications.filter((item) => item?.api?.id === this.api.id).length > 0;
|
||||
})
|
||||
.catch((error) => {});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user