chore: Minor optimizations
- Optimize code, update a validation message and fix code inspection warning
This commit is contained in:
parent
e7ada4b47d
commit
b0650a5bf4
2 changed files with 4 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useId, useTemplateRef } from "vue";
|
||||
import CountryListItem from "./CountryListItem.vue";
|
||||
import { Country, getAvailableCountries } from "../utils/countries";
|
||||
import { type Country, getAvailableCountries } from "../utils/countries.ts";
|
||||
|
||||
const formModel = ref(false);
|
||||
const formRef = useTemplateRef("form");
|
||||
|
@ -22,10 +22,7 @@ const state = ref("");
|
|||
const locality = ref("");
|
||||
|
||||
// Countries data for autocomplete
|
||||
const countries = ref<(Country | { divider: boolean; header: string })[]>([]);
|
||||
|
||||
// Initialize countries list
|
||||
countries.value = getAvailableCountries();
|
||||
const countries = ref(getAvailableCountries());
|
||||
|
||||
// Certificate settings
|
||||
const keyLength = ref(4096);
|
||||
|
@ -35,7 +32,7 @@ const noExpiry = ref(false);
|
|||
// Validation rules
|
||||
const domainRules = [
|
||||
(value: string) => !!value || "A value must be provided to add the domain.",
|
||||
(value: string) => new RegExp("^[a-z0-9][a-z0-9.]+$").test(value) || "Invalid domain characters provided. (To use some characters, convert the domain to xn-domain format.)",
|
||||
(value: string) => /^[a-z0-9][a-z0-9.\-_]+$|^xn--[a-z0-9.\-_]+$/i.test(value) || "Invalid domain characters provided. (To use some special characters, convert the domain to xn-domain format.)",
|
||||
]
|
||||
|
||||
const emailRules = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue