Changeset 285c3cc for pages/api/postgre


Ignore:
Timestamp:
06/16/22 17:01:08 (3 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
9bd09b0
Parents:
ebf5e04
Message:

Removed double client-side api requests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pages/api/postgre/index.js

    rebf5e04 r285c3cc  
    170170    /**
    171171     * /---------------------- GET ----------------------/
    172      * Returns the player's room, if the player was in one.
    173      * Same as the one below, but this one is used in a game-specific context.
    174      * @action get_player_info_on_enter
    175      * @param session_id
    176      */
    177     if (req.query?.action === 'get_player_info_on_enter' && req.query?.session_id) {
    178       const session_id = req.query.session_id
    179       const session = sessions.find(session => session.id === session_id)
    180 
    181       if (session) {
    182         res.json({
    183           success: true,
    184           displayName: session.displayName,
    185           session_id: session.id,
    186           credits: session.credits,
    187         })
    188         return ;
    189       }
    190 
    191       res.json({
    192         success: false,
    193       })
    194     }
    195 
    196     /**
    197      * /---------------------- GET ----------------------/
    198      * Returns the player's room, if the player was in one.
    199      * Same as the one above, but this one is used in a general context.
     172     * Checks if the player is logged in, and returns his session if so.
    200173     * @action check_if_logged_in
    201174     * @param session_id
Note: See TracChangeset for help on using the changeset viewer.