Skip to content

Commit 1686fe3

Browse files
author
Ferenc Nánási
committed
Added validation to add/update collection modal
1 parent 78a8ee2 commit 1686fe3

File tree

5 files changed

+32
-325
lines changed

5 files changed

+32
-325
lines changed

android/app/release/output-metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
"outputFile": "app-release.apk"
1616
}
1717
]
18-
}
18+
}

android/app/src/main/AndroidManifest.xml.orig

-317
This file was deleted.

android/app/src/main/assets/capacitor.config.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
"appId": "com.husudosu.mpvremote",
33
"appName": "MPV Remote",
44
"webDir": "dist",
5-
"bundledWebRuntime": false,
6-
"server": {
7-
"url": "http://192.168.88.164:8100"
8-
}
5+
"bundledWebRuntime": false
96
}

src/components/addCollectionModal.vue

+18-1
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,25 @@ export default {
104104
props.modalController.dismiss();
105105
};
106106
107+
const validateForm = () => {
108+
let errors = [];
109+
if (dialog.value.name.length === 0) {
110+
errors.push("Name required!");
111+
}
112+
if (dialog.value.paths.length === 0) {
113+
errors.push("At least one path required!");
114+
}
115+
116+
if (errors.length > 0) {
117+
alert(`Validation errors:\n-${errors.join("\n-")}`);
118+
return false;
119+
} else return true;
120+
};
121+
107122
const onSubmitClicked = () => {
108-
props.modalController.dismiss(dialog.value);
123+
if (validateForm()) {
124+
props.modalController.dismiss(dialog.value);
125+
}
109126
};
110127
111128
const onDeleteCollectionCliced = () => {

0 commit comments

Comments
 (0)