diff --git a/src/data.cpp b/src/data.cpp index 6c5668a..caa6e68 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -56,16 +56,17 @@ bool data::validate(const json &input) { const std::string phone = input.value("phone", ""); const std::string email = input.value("email", ""); - const std::vector strings{name, address, phone, email}; + const std::unordered_map strings{ + {"name", name}, {"address", address}, {"phone", phone}, {"email", email}}; for (const auto &f : strings) { - if (f.size() == 0) { + if (f.second.size() == 0) { return false; } - if (f.size() >= 255) { + if (f.second.size() >= 255) { return false; } } return true; -} \ No newline at end of file +}