diff --git a/project/static/vue/common/typeahead.vue.js b/project/static/vue/common/typeahead.vue.js index 4e72d1e..c030369 100644 --- a/project/static/vue/common/typeahead.vue.js +++ b/project/static/vue/common/typeahead.vue.js @@ -67,7 +67,7 @@ const CustomTypeahead = { vm.suggestions = response.data.items }) }, - fetchDataDebounced: _.debounce(function(query) { this.fetchData(query) }, 200), + fetchDataDebounced: _.debounce(function(query) { this.fetchData(query) }, 1000), onInput() { this.selected = null; this.fetchDataDebounced(this.query) diff --git a/project/static/vue/organization-organization-invitations/create.vue.js b/project/static/vue/organization-organization-invitations/create.vue.js index dde6129..75cbd5a 100644 --- a/project/static/vue/organization-organization-invitations/create.vue.js +++ b/project/static/vue/organization-organization-invitations/create.vue.js @@ -16,7 +16,8 @@ const OrganizationOrganizationInvitationCreate = { :label="$t('shared.models.adminUnitInvitation.organizationName')" name="organizationName" v-model="form.organization_name" - rules="required" /> + rules="required|uniqueOrganizationName" + :debounce="1000" /> + rules="required|uniqueOrganizationName" + :debounce="1000" /> { + try { + const response = await axios.get( + `/api/v1/organizations?keyword=${value}`, { + withCredentials: true, + } + ); + return !response.data.items.some(o => o.name == value); + } catch (err) { + return true; + } + } + }, { + immediate: false + }); + {% block vue_routes %} {% endblock %}