Index: pages/api/blackjack/gameStates.js
===================================================================
--- pages/api/blackjack/gameStates.js	(revision 433e0c5f4289ea953d6d2c2d010c6bd651bd0c8f)
+++ pages/api/blackjack/gameStates.js	(revision 55701f0270de2168597a7ca5d1a05ae6a66f516b)
@@ -1,2 +1,4 @@
+import { rooms } from "../postgre";
+
 const singleDeck = ["SA", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "SX", "SJ", "SQ", "SK",
                     "HA", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9", "HX", "HJ", "HQ", "HK",
@@ -11,4 +13,5 @@
  */
 export let game = {
+  credits: -1,
   deck: [...deck],
   status: '_1_room_created',      // statuses: _1_room_created, _2_made_initial_bet, _3_made_side_bet, _4_cards_on_the_table, _5_game_over
@@ -23,4 +26,31 @@
   sideBetOutcome: '',
   sideBetEarnings: 0,
+  messageTitle: '',
+  messageDescription: '',
+  betOutcomeMessageShown: true,
+  sideBetOutcomeMessageShown: true,
+}
+
+export function getGame(session_id) {
+  if (rooms[session_id] !== undefined) {
+    return {
+      success: true,
+      game: rooms[session_id],
+    }
+  }
+
+  return {
+      success: false,
+      game: {...game, playerCards: [...game.playerCards], dealerCards: [...game.dealerCards]},
+  };
+}
+
+export function getRestrictedGameObject(session_id) {
+  const { success, game } = getGame(session_id)
+
+  return {
+    ...game,
+    dealerCards: game.status.includes('_5_') ? game.dealerCards : game.dealerCards.length > 0 ? [game.dealerCards[0]].concat(['back']) : [],
+  }
 }
 
Index: pages/api/blackjack/index.js
===================================================================
--- pages/api/blackjack/index.js	(revision 433e0c5f4289ea953d6d2c2d010c6bd651bd0c8f)
+++ pages/api/blackjack/index.js	(revision 55701f0270de2168597a7ca5d1a05ae6a66f516b)
@@ -3,5 +3,5 @@
 require('dotenv').config();
 
-import { game, drawASingleCard, getInitialCards, calculateHandValue } from './gameStates';
+import { game, drawASingleCard, getInitialCards, calculateHandValue, getGame, getRestrictedGameObject } from './gameStates';
 import { calculateEarnings, calculateSideBetEarnings } from './calculateEarnings';
 
@@ -39,17 +39,28 @@
         rooms[session_id] = {...game, playerCards: [...game.playerCards], dealerCards: [...game.dealerCards]};
 
-        res.json({
-          success: true,
-          game: rooms[session_id],
-        })
+        rooms[session_id].betOutcomeMessageShown = true;
 
         update_rooms_to_database();
-
-        return ;
-      }
-
-      res.json({
-        success: false,
-      })
+      }
+
+      res.end();
+    }
+
+    /**
+     * /---------------------- GET ----------------------/
+     * If game status is _4_cards_on_the_table, turn off the alert for side bet outcome
+     * @action continue_from_side_bet
+     * @param session_id
+     */
+     if (req.query.action === 'continue_from_side_bet' && req.query?.session_id) {
+      const session_id = req.query.session_id;
+
+      if (rooms[session_id] !== undefined && rooms[session_id].status.substr(1, 1) === '4') {
+        rooms[session_id].sideBetOutcomeMessageShown = true;
+
+        update_rooms_to_database();
+      }
+
+      res.end();
     }
 
@@ -88,8 +99,28 @@
         room.earnings = calculateEarnings(room);
 
+        if (room.outcome === 'draw') {
+          room.messageTitle = 'Draw!';
+          room.messageDescription = `You got your $${room.earnings} back`
+        }
+        else if (room.outcome === 'player_won') {
+          room.messageTitle = 'You won!';
+          room.messageDescription = `You won $${room.earnings}`
+        }
+        else if (room.outcome === 'dealer_busted') {
+          room.messageTitle = `Dealer ${room.dealerName} busted!`;
+          room.messageDescription = `You won $${room.earnings}`
+        }
+        else if (room.outcome === 'player_lost') {
+          room.messageTitle = 'You lost!';
+          room.messageDescription = `You lost $${-1*room.earnings}`
+        }
+        room.betOutcomeMessageShown = false;
+
         rooms[session_id] = room;
 
         axios.get(`${process.env.HOME_URL}/api/postgre/?action=add_credits&session_id=${session_id}&credits=${room.earnings}&game=blackjack&outcome=${room.outcome}`).then(postgreRes => {
           if (postgreRes.data?.success) {
+            rooms[session_id].credits = postgreRes.data?.credits;
+
             res.json({
               success: true,
@@ -139,6 +170,11 @@
           room.status = '_5_game_over';
           room.outcome = 'player_busted';
-
+          
           room.earnings = calculateEarnings(room);
+
+          room.messageTitle = 'You busted!';
+          room.messageDescription = `You lost $${-1*room.earnings}`
+          
+          room.betOutcomeMessageShown = false;
 
           rooms[session_id] = room;
@@ -146,4 +182,6 @@
           axios.get(`${process.env.HOME_URL}/api/postgre/?action=add_credits&session_id=${session_id}&credits=${room.earnings}&game=blackjack&outcome=${room.outcome}`).then(postgreRes => {
             if (postgreRes.data?.success) {
+              rooms[session_id].credits = postgreRes.data?.credits;
+
               res.json({
                 success: true,
@@ -207,46 +245,30 @@
           room.sideBetOutcome = room.sideBetEarnings > 0 ? 'side_bet_won' : 'side_bet_lost';
 
+          if (room.sideBetOutcome === 'side_bet_won') {
+            room.messageTitle = `You won the side bet!`;
+            room.messageDescription = `You won $${room.sideBetEarnings}`
+          }
+          else if (room.sideBetOutcome === 'side_bet_lost') {
+            room.messageTitle = `You lost the side bet!`;
+            room.messageDescription = `You lost $${-1*room.sideBetEarnings}`
+          }
+
+          room.sideBetOutcomeMessageShown = false;
+          
           rooms[session_id] = room;
+
+          update_rooms_to_database();
 
           axios.get(`${process.env.HOME_URL}/api/postgre/?action=add_credits&session_id=${session_id}&credits=${room.sideBetEarnings}`).then(postgreRes => {
             if (postgreRes.data?.success) {
-              res.json({
-                success: true,
-                status: rooms[session_id].status,
-                playerCards: rooms[session_id].playerCards,
-                dealerCards: Array(rooms[session_id].dealerCards[0]).concat('back'),
-                sideBetOutcome: rooms[session_id].sideBetOutcome,
-                sideBetEarnings: rooms[session_id].sideBetEarnings,
-                credits: postgreRes.data?.credits,
-              })
-            
+              rooms[session_id].credits = postgreRes.data?.credits;
+
               update_rooms_to_database();
             }
-            else {
-              res.json({
-                success: false,
-              })
-            }
           });
         }
-        else {
-          res.json({
-            success: true,
-            status: rooms[session_id].status,
-            playerCards: rooms[session_id].playerCards,
-            dealerCards: Array(rooms[session_id].dealerCards[0]).concat('back'),
-            sideBetOutcome: rooms[session_id].sideBetOutcome,
-            sideBetEarnings: rooms[session_id].sideBetEarnings,
-          })
-            
-          update_rooms_to_database();
-        }
-
-        return ;
-      }
-
-      res.json({
-        success: false,
-      })
+      }
+
+      res.end();
     }
 
@@ -259,5 +281,5 @@
      * @param betName
      */
-     if (req.query.action === 'make_side_bet' && req.query?.session_id && req.query?.bet && req.query?.betName) {
+    if (req.query.action === 'make_side_bet' && req.query?.session_id && req.query?.bet && req.query?.betName) {
       const session_id = req.query.session_id;
 
@@ -269,4 +291,6 @@
         axios.get(`${process.env.HOME_URL}/api/postgre?action=take_credits&session_id=${session_id}&credits=${req.query.bet}`).then(postgreRes => {
           if (postgreRes.data?.success) {
+            rooms[session_id].credits = postgreRes.data?.credits;
+
             const room = rooms[session_id];
 
@@ -279,18 +303,13 @@
             res.json({
               success: true,
-              status: rooms[session_id].status,
-              credits: postgreRes.data?.credits,
             })
             
             update_rooms_to_database();
           }
+          else {
+            res.end();
+          }
         });
-        
-        return ;
-      }
-
-      res.json({
-        success: false,
-      })
+      }
     }
     
@@ -310,4 +329,6 @@
         axios.get(`${process.env.HOME_URL}/api/postgre?action=take_credits&session_id=${session_id}&credits=${req.query.bet}`).then(postgreRes => {
           if (postgreRes.data?.success) {
+            rooms[session_id].credits = postgreRes.data?.credits;
+
             const room = rooms[session_id];
 
@@ -316,26 +337,11 @@
 
             rooms[session_id] = room;
-
-            res.json({
-              success: true,
-              status: rooms[session_id].status,
-              credits: postgreRes.data?.credits,
-            })
             
             update_rooms_to_database();
           }
-          else {
-            res.json({
-              success: false,
-            })
-          }
         });
-
-        return ;
-      }
-
-      res.json({
-        success: false,
-      })
+      }
+
+      res.end();
     }
 
@@ -358,4 +364,21 @@
             
       update_rooms_to_database();
+    }
+
+    /**
+     * /---------------------- GET ----------------------/
+     * Updates the state periodically
+     * @action update_state
+     * @param session_id
+     */
+     if (req.query.action === 'update_state' && req.query?.session_id) {
+      const session_id = req.query.session_id;
+
+      const { success, game } = getGame(session_id);
+
+      res.json({
+          success: true,
+          blackjackGame: getRestrictedGameObject(session_id),
+      })
     }
 
