Skip to content

Commit 2b7d8a8

Browse files
committed
lint(modeling-commons): tighten fronend validation of social links maximum count per type
1 parent e5288e9 commit 2b7d8a8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

apps/modeling-commons-frontend/app/components/shared/SocialLinksInput.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ const addLink = () => {
3131
if (!model.value || !currentInput.value) {
3232
return;
3333
}
34+
if (props.onePerKind && links.value.some((link) => link.type === model.value?.value)) {
35+
error.value = "You can only add one link of each type.";
36+
return;
37+
}
3438
const { value, schema } = model.value;
3539
const { data, error: parseError } = schema.safeParse(currentInput.value); // Will throw if invalid, preventing addition
3640
if (!data) {

0 commit comments

Comments
 (0)