minor changes

This commit is contained in:
Tina_Azure
2023-04-19 02:11:59 +02:00
parent ab2229dd8a
commit 9e0eb83eba
3 changed files with 9 additions and 5 deletions

View File

@ -340,7 +340,7 @@ namespace Database {
* parses it fully and returns a JSON containing it at the top or below a variable
* takes the result and optionally a name for the top level variable
*/
crow::json::wvalue convertResultToJSON(pqxx::result &result, std::string jsonName = ""){
crow::json::wvalue convertResultToJSON(pqxx::result &result, std::string jsonName){
std::vector<crow::json::wvalue> jsonVector;
for (int row = 0; row < result.size(); ++row) {
crow::json::wvalue jsonVectorItem;
@ -350,7 +350,7 @@ namespace Database {
jsonVector.push_back(jsonVectorItem);
}
crow::json::wvalue returnJson;
if (jsonName != ""){
if (!jsonName.empty()){
returnJson[jsonName] = crow::json::wvalue(jsonVector);
}
else

View File

@ -15,8 +15,8 @@ int main(int argc, char *argv[]) {
configuration.configPath = argv[1];
if (configuration.readConfigFile()) {
std::cout << "ERROR: Unable to read configuration file: " << configuration.configPath << endl;
std::cout << "Aborting Startup!" << endl;
cout << "ERROR: Unable to read configuration file: " << configuration.configPath << endl;
cout << "Aborting Startup!" << endl;
return 1;
}
@ -264,6 +264,7 @@ int main(int argc, char *argv[]) {
CROW_ROUTE(app, "/freelancer/login")
([&,databaseURI](const crow::request& getRequest ) {
/*
auto& ctx = app.get_context<crow::CookieParser>(getRequest);
// Read cookies with get_cookie
auto value = ctx.get_cookie("cookieloggedin");
@ -275,7 +276,7 @@ int main(int argc, char *argv[]) {
{
ctx.set_cookie("cookieloggedin", "false");
}
return "cookieloggedin: " + value;
return "cookieloggedin: " + value;*/

View File

@ -28,6 +28,9 @@
<form action="/freelancer/login" method="get">
<button type="submit" class="button">Freelancer Login</button>
</form>
<form action="/freelancer/signup" method="get">
<button type="submit" class="button">Freelancer Sign-Up</button>
</form>
{{/cookieloggedin}}
{{#cookieloggedin}}
<form action="/freelancer/profile" method="get">