UI updates and bug fixes
[browser-rts.git] / src / api.ts
index 76873678c2d2741723ddcb932c702439760f9c08..5f48de443d383b76ec6375fd80d9ef63f0088a08 100644 (file)
@@ -47,7 +47,7 @@ server.post<{
        // lets create the city!
        await cityRepo.create(acct.id);
 
-       return `<p>You are all signed up! You can go ahead and log in</p>`;
+       return `<div class="alert success">You are all signed up! You can go ahead and log in</div>`;
 });
 
 server.post<{body: {username: string, password: string}}, void>('/login', async (req, raw, res) => {
@@ -137,7 +137,12 @@ server.post<{
                building_type: string
        }
 }, string>('/cost/construction', async req => {
-       const amount = parseInt(req.body.amount, 10);
+       const amount = parseInt(req.body.amount.trim(), 10);
+       console.log('checking amount', amount);
+
+       if(isNaN(amount) || amount < 1) {
+               return '';
+       }
        const building = await cityRepo.buildingRepository.findBySlug(req.body.building_type);
 
        if(!building) {