fix: Server side validation for #3112

This commit is contained in:
Tom Moor
2022-02-17 22:51:18 -08:00
parent 3d5bf56d09
commit 9db6951434
3 changed files with 17 additions and 3 deletions

View File

@@ -36,8 +36,10 @@ export const assertSort = (
}
};
export const assertNotEmpty = (value: unknown, message?: string) => {
if (value === "") {
export const assertNotEmpty = (value: unknown, message: string) => {
assertPresent(value, message);
if (typeof value === "string" && value.trim() === "") {
throw ValidationError(message);
}
};