Ignore:
Timestamp:
07/12/22 17:03:03 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
1df3fde
Parents:
d0ef259
Message:

Saving roulette data to database

File:
1 edited

Legend:

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

    rd0ef259 re9f11ac  
    11import axios from 'axios';
     2
     3import { game, update_game_to_database } from '../postgre/index'
    24
    35require('dotenv').config();
     
    141143})();
    142144
    143 let game = {
    144     status: '_1_ongoing_timer',     // statuses: _1_ongoing_timer, _2_spinning,
    145     timeToStart: 30,                // in seconds
    146     COUNTDOWN_FROM: 30,
    147     WAIT_BEFORE: 20,
    148     magicNumber: -1,
    149     winningBets: [],
    150     players: [],
     145if (game.status === undefined) {
     146    game.status = '_1_ongoing_timer';     // statuses: _1_ongoing_timer, _2_spinning
     147    game.timeToStart = 30;                // in seconds
     148    game.COUNTDOWN_FROM = 30;
     149    game.WAIT_BEFORE = 20;
     150    game.magicNumber = -1;
     151    game.winningBets = [];
     152    game.players = [];
    151153}
    152154
     
    262264            }
    263265
     266            if (game.loaded !== undefined && game.loaded) {
     267                update_game_to_database();
     268            }
     269
    264270            res.json({
    265271                success: true,
Note: See TracChangeset for help on using the changeset viewer.