Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7 from DainWs/deploy/tests
Browse files Browse the repository at this point in the history
Deploy/tests
  • Loading branch information
DainWs authored May 29, 2022
2 parents be51e7b + c1eaebc commit 74ce5cf
Show file tree
Hide file tree
Showing 38 changed files with 143 additions and 50 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
"private": true,
"scripts": {
"start": "cd void-eye-games-client && npm run start && cd ..",
"build": "cd void-eye-games-client && npm run build && cd ..",
"deploy": "npm run install",
"build": "npm run build-client",
"deploy": "npm install",
"install": "npm run install-api && npm run install-client",
"install-api": "cd void-eye-games-api && composer install && cd ..",
"install-client": "cd void-eye-games-client && npm install && cd .."
"install-client": "cd void-eye-games-client && npm install && cd .. && npm run build-client",
"build-client": "cd void-eye-games-client && npm run build && cd .."
},
"keywords": [],
"author": "Jose Antonio Duarte Perez",
Expand Down
115 changes: 100 additions & 15 deletions sql/SQLInserts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,143 @@ INSERT INTO CATEGORIES VALUES (null, "Multijugador");
INSERT INTO CATEGORIES VALUES (null, "Supervivencia");
INSERT INTO CATEGORIES VALUES (null, "RPG");
INSERT INTO CATEGORIES VALUES (null, "Coches");
INSERT INTO CATEGORIES VALUES (null, "Shooter");
INSERT INTO CATEGORIES VALUES (null, "Rol");
COMMIT;

INSERT INTO PLATAFORMS VALUES (null, "Microsoft", "https://www.xbox.com/es-es/promotions/sales/spring-sale");
INSERT INTO PLATAFORMS VALUES (null, "Steam", "https://store.steampowered.com/?l=spanish");
INSERT INTO PLATAFORMS VALUES (null, "Gamivo", "https://www.gamivo.com/");
INSERT INTO PLATAFORMS VALUES (null, "Epic games", "https://www.epicgames.com/site/es-ES/home");
INSERT INTO PLATAFORMS VALUES (null, "Instant gaming", "https://www.instant-gaming.com/es/");
INSERT INTO PLATAFORMS VALUES (null, "Riot Games", "https://www.riotgames.com/es");
COMMIT;

/* The password is 'prueba' */
INSERT INTO USERS VALUES (null, "admin", "c893bad68927b457dbed39460e6afd62", "void.eye.games@gmail.com", 'logo.png', 0, 0);
INSERT INTO USERS VALUES (null, "Juan Alverto", "c893bad68927b457dbed39460e6afd62", "Juan@void.eye.games.com", null, 1, 1);
INSERT INTO USERS VALUES (null, "Pepito Golosinas", "c893bad68927b457dbed39460e6afd62", "PepitoGolosinas@void.eye.games.com", null, 0, 1);
INSERT INTO USERS VALUES (null, "MªCarmen", "c893bad68927b457dbed39460e6afd62", "MCarmen@void.eye.games.com", null, 1, 1);
INSERT INTO USERS VALUES (null, "Lucia", "c893bad68927b457dbed39460e6afd62", "Lucia@void.eye.games.com", null, 0, 1);
COMMIT;

INSERT INTO GAMES VALUES (null, "Minecraft", "What is it? Minecraft is a video game in which players create and break apart various kinds of blocks in three-dimensional worlds. The game’s two main modes are Survival and Creative. In Survival, players must find their own building supplies and food. They also interact with blocklike mobs, or moving creatures. (Creepers and zombies are some of the dangerous ones.) In Creative, players are given supplies and do not have to eat to survive. They also can break all kinds of blocks immediately.\nAre there points or levels? No. The purpose of the game is simply to build and explore (and survive).\nHow many players can play it? You can play by yourself or you can play online with others. The smartphone and tablet versions offer multi-player options through WiFi networks. Players can connect to thousands of Minecraft online games (servers), some of which involve battling other players.\nWhich devices can I play it on? There are versions for PCs, Macs and Xbox 360. There’s also a version for iPhone, iPad, Kindle Fire and Android smartphones.");
INSERT INTO GAMES VALUES (null, "GTA V", "When a young street hustler, a retired bank robber and a terrifying psychopath find themselves involved with the worst and most insane of the criminal underworld, the US government and the entertainment industry, they must pull off a series of dangerous hits to survive in an unforgiving city where no one can be trusted. And much less in each other.\n\nGrand Theft Auto V for PC gives gamers the option to explore the award-winning world of Los Santos and Blaine County in 4K resolution and enjoy gameplay at 60 frames per second.\n\nThe game features multiple and varied PC-specific customization options, with over 25 different configurable settings for texture quality, shader, tessellation, anti-aliasing, and many other items, as well as mouse and keyboard customization options. It is also possible to modify the population density to control vehicle and pedestrian traffic, and it is compatible with two and three monitors, 3D and plug-and-play controllers.\n\nGrand Theft Auto V for PC also includes Grand Theft Auto Online, supporting 30 players and two spectators. Grand Theft Auto Online for PC will include all Rockstar-created enhancements and content since the launch date of Grand Theft Auto Online, including Heists and Adversary Modes.\n\nThe PC version of Grand Theft Auto V and Grand Theft Auto Online features First Person View, giving players the ability to explore every detail of the world of Los Santos and Blaine County in a whole new way.\n\nGrand Theft Auto V for PC also features the new Rockstar Editor, a set of tools that make it quick and easy to record, edit and share videos from Grand Theft Auto V and Grand Theft Auto Online. Thanks to the Rockstar Editor's director mode, players can bring their ideas to life and create scenes with in-game characters, pedestrians and even animals. The editor has advanced camera movement techniques, editing effects such as slow or fast motion images, various camera filters, the ability to add songs from GTA V radio stations or dynamically control the intensity of the music of the game. Finished videos can be uploaded directly to YouTube and the Rockstar Games Social Club from within the Rockstar Editor for easy sharing.\n\nThe Alchemist and Oh No, composers of the soundtrack, are the announcers of the new in-game radio, 'The Lab FM', which broadcasts new and exclusive songs from these two artists inspired by the original music of the game. Other guest artists like Earl Sweatshirt, Freddie Gibbs, Little Dragon, Killer Mike and Sam Herring of Future Islands, to name a few, also collaborate. Players can also discover Los Santos and Blaine County while listening to their own music on 'Your Radio,' a new station with a player-created and personalized soundtrack.");
INSERT INTO GAMES VALUES (null, "Rocket League", "Rocket League is a fantastical sport-based video game, developed by Psyonix (it's “soccer with cars”). It features a competitive game mode based on teamwork and outmaneuvering opponents. Players work with their team to advance the ball down the field, and score goals in their opponents' net.");
INSERT INTO GAMES VALUES (null, "League of legends", "League of Legends is a team strategy game in which two teams of five champions face off to see who destroys the other's base first. Choose from a roster of 140 champions to pull off epic plays, assassinate opponents, and take down turrets to claim victory.");
INSERT INTO GAMES VALUES (null, "V Rising", "Wake up as a vampire weakened after centuries of slumber. Go hunting for blood to regain your strength, while hiding from the scorching sunlight. Rebuild your castle and transform humans into your loyal servants on a quest to achieve your vampire empire. Make allies or enemies playing online or play alone, challenging holy soldiers and battling in the war of a world plunged into conflict.\n\nWill you be the one to rise as the next Dracula?.");
INSERT INTO GAMES VALUES (null, "Among Us", "Among Us is a game very similar to the classic 'The Assassin' that we have played once on cards, but brought to the world of video games. You are in a spaceship, and two imposters who are 'among us', hence the title, have to kill the other eight crew members before they discover them.");
INSERT INTO GAMES VALUES (null, "Valorant", "Valorant is a first-person shooter where two teams of five players face off against each other. In addition to the usual shots, the objective of the games is to place a device called Spike in a specific area of ​​the map.");
INSERT INTO GAMES VALUES (null, "Evolve Stage 2", "Evolve Stage 2 is Now Free to Play on Steam!\n\nEvolve Stage 2 is a next-generation free multiplayer shooter featuring addictive 4v1 gameplay. One player-controlled monster must evade and outsmart a team of four uniquely skilled hunters.");
COMMIT;

INSERT INTO COMMENTS VALUES (null, 2, 1, "Un comentario de ejemplo");
INSERT INTO COMMENTS VALUES (null, 2, 1, "A revolution for this time without a doubt.");
INSERT INTO COMMENTS VALUES (null, 3, 1, "A game of cubes and survival, very original, I recommend it.");
INSERT INTO COMMENTS VALUES (null, 4, 1, "It seems like an easy game.");
INSERT INTO COMMENTS VALUES (null, 3, 2, "Very good game, and more if it is accompanied by a delicious");
INSERT INTO COMMENTS VALUES (null, 2, 2, "The second best-selling game in history and approximately 8 years old, which is being exploited by rockstar to this day with very acceptable graphics to this day, in addition to being one of the best open world games.");
INSERT INTO COMMENTS VALUES (null, 3, 2, "So good.");
INSERT INTO COMMENTS VALUES (null, 4, 2, "So good.");
INSERT INTO COMMENTS VALUES (null, 2, 2, "So bad, I dont really like it.");
INSERT INTO COMMENTS VALUES (null, 3, 2, "its okey.");
INSERT INTO COMMENTS VALUES (null, 5, 2, "its okey.");
INSERT INTO COMMENTS VALUES (null, 5, 3, "its okey.");
INSERT INTO COMMENTS VALUES (null, 3, 3, "Very competitive and the games are fast, I love it, I recommend it.");
INSERT INTO COMMENTS VALUES (null, 4, 4, "I hate it, but it's a vice and I can't stop playing it, help.");
INSERT INTO COMMENTS VALUES (null, 3, 5, "It is very very good to be a Beta, I totally recommend it.");
INSERT INTO COMMENTS VALUES (null, 5, 6, "I don't like it, they keep ejecting me for killing a colleague.");
INSERT INTO COMMENTS VALUES (null, 4, 7, "I hate it, but it's a vice and I can't stop playing it, help.");
INSERT INTO COMMENTS VALUES (null, 2, 8, "Its so amazing, I recommend it.");
INSERT INTO COMMENTS VALUES (null, 3, 8, "It's too expensive, I don't recommend it.");
INSERT INTO COMMENTS VALUES (null, 4, 8, "They have raised the price again, I don't see it anymore.");
INSERT INTO COMMENTS VALUES (null, 5, 8, "This game is dead.");
COMMIT;

INSERT INTO MEDIAS VALUES (null, 1, "imagen_1", "image/png");
INSERT INTO MEDIAS VALUES (null, 1, "video_1", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 2, "video_2", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 2, "imagen_2", "image/png");
INSERT INTO MEDIAS VALUES (null, 3, "imagen_3", "image/jpg");
INSERT INTO MEDIAS VALUES (null, 1, "main_image", "image/png");
INSERT INTO MEDIAS VALUES (null, 1, "trailer", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 2, "trailer", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 2, "main_image", "image/png");
INSERT INTO MEDIAS VALUES (null, 3, "main_image", "image/jpg");
INSERT INTO MEDIAS VALUES (null, 4, "main_image", "image/webp");
INSERT INTO MEDIAS VALUES (null, 4, "zed", "image/jpeg");
INSERT INTO MEDIAS VALUES (null, 4, "trailer", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 4, "teaser-2020", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 5, "main_man_image", "image/jpg");
INSERT INTO MEDIAS VALUES (null, 5, "trailer", "video/mp4");
INSERT INTO MEDIAS VALUES (null, 5, "main_woman_image", "image/jpg");
INSERT INTO MEDIAS VALUES (null, 6, "main_image", "image/png");
INSERT INTO MEDIAS VALUES (null, 7, "main_image", "image/webp");
COMMIT;

/** Categories **/
/* Minecraft */
INSERT INTO categories_games VALUES (1, 1);
INSERT INTO categories_games VALUES (2, 1);
INSERT INTO categories_games VALUES (3, 1);
INSERT INTO categories_games VALUES (4, 1);

/* GTA V */
INSERT INTO categories_games VALUES (1, 2);
INSERT INTO categories_games VALUES (2, 2);
INSERT INTO categories_games VALUES (3, 2);

/* Rocket League */
INSERT INTO categories_games VALUES (1, 3);
INSERT INTO categories_games VALUES (2, 3);
INSERT INTO categories_games VALUES (6, 3);

/* League of legends */
INSERT INTO categories_games VALUES (3, 4);
INSERT INTO categories_games VALUES (8, 4);

/* V Rising */
INSERT INTO categories_games VALUES (1, 5);
INSERT INTO categories_games VALUES (2, 5);
INSERT INTO categories_games VALUES (3, 5);
INSERT INTO categories_games VALUES (4, 5);

/* Among Us */
INSERT INTO categories_games VALUES (4, 6);
INSERT INTO categories_games VALUES (8, 6);

/* Valorant */
INSERT INTO categories_games VALUES (7, 7);
INSERT INTO categories_games VALUES (8, 7);

/* Evolve Stage 2 */
INSERT INTO categories_games VALUES (1, 8);
INSERT INTO categories_games VALUES (2, 8);
INSERT INTO categories_games VALUES (3, 8);
INSERT INTO categories_games VALUES (4, 8);
INSERT INTO categories_games VALUES (5, 8);
INSERT INTO categories_games VALUES (7, 8);
COMMIT;

INSERT INTO plataforms_games VALUES (1, 1, 25.99, 'EUR', 0.0, 1);
INSERT INTO plataforms_games VALUES (3, 1, 15.99, 'EUR', 0.0, 1);
INSERT INTO plataforms_games VALUES (2, 2, 31.99, 'EUR', 0.3, 1);
INSERT INTO plataforms_games VALUES (4, 2, 28.99, 'EUR', 0.0, 1);
INSERT INTO plataforms_games VALUES (3, 3, 12.75, 'EUR', 0.0, 1);
INSERT INTO plataforms_games VALUES (4, 3, 12.00, 'USD', 0.0, 1);
INSERT INTO plataforms_games VALUES (5, 3, 12.75, 'EUR', 0.0, 0);
/** Plataform games **/
/* Accepted types: EUR/USD */
/* Microsoft Games */
INSERT INTO plataforms_games VALUES (1, 1, 25.99, 'EUR', 0.0, 1); /* Minecraft */
INSERT INTO plataforms_games VALUES (1, 6, 4.99, 'EUR', 0.0, 1); /* Among Us */

/* Steam Games */
INSERT INTO plataforms_games VALUES (2, 2, 31.99, 'EUR', 0.3, 1); /* GTA V */
INSERT INTO plataforms_games VALUES (2, 5, 21.18, 'EUR', 0.0, 1); /* V Rising */
INSERT INTO plataforms_games VALUES (2, 6, 3.99, 'EUR', 0.0, 1); /* Among Us */
INSERT INTO plataforms_games VALUES (2, 8, 59.99, 'EUR', 0.0, 0); /* Evolve Stage 2 */

/* Gamivo Games */
INSERT INTO plataforms_games VALUES (3, 1, 19.14, 'EUR', 0.0, 1); /* Minecraft */
INSERT INTO plataforms_games VALUES (3, 3, 357.26, 'EUR', 0.0, 1); /* Rocket League */
INSERT INTO plataforms_games VALUES (3, 5, 21.18, 'EUR', 0.0, 1); /* V Rising */

/* Epic Games */
INSERT INTO plataforms_games VALUES (4, 2, 29.99, 'EUR', 0.5, 1); /* GTA V */
INSERT INTO plataforms_games VALUES (4, 3, 0.00, 'USD', 0.0, 1); /* Rocket League */
INSERT INTO plataforms_games VALUES (4, 6, 3.99, 'EUR', 0.2, 1); /* Among Us */

/* Instant gaming Games */
INSERT INTO plataforms_games VALUES (5, 3, 12.75, 'EUR', 0.0, 1); /* Rocket League */
INSERT INTO plataforms_games VALUES (5, 5, 0.00, 'EUR', 0.0, 0); /* V Rising */

/* Riot Games */
INSERT INTO plataforms_games VALUES (6, 4, 0.00, 'EUR', 0.0, 1); /* League of legends */
INSERT INTO plataforms_games VALUES (6, 7, 0.00, 'EUR', 0.0, 1); /* Valorant */
COMMIT;
5 changes: 4 additions & 1 deletion sql/SQLQueries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ SELECT * FROM categories_games;

USE void_eye_games;
SELECT * FROM plataforms;
SELECT * FROM plataforms_games;
SELECT * FROM plataforms_games;


SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = 'void_eye_games';
9 changes: 5 additions & 4 deletions sql/SQLSentences.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ ALTER TABLE plataforms_games ADD CONSTRAINT fk_plataforms_games_games FOREIGN KE
ALTER TABLE plataforms_games ADD CONSTRAINT fk_plataforms_games_plataforms FOREIGN KEY(plataformsId) REFERENCES plataforms(id);

CREATE TABLE IF NOT EXISTS medias(
id INT(255) auto_increment NOT NULL,
id INT(255) NOT NULL AUTO_INCREMENT,
gamesId INT(255) NOT NULL,
name VARCHAR(100) NOT NULL,
mediaType VARCHAR(100) NOT NULL DEFAULT "image/png",
CONSTRAINT pk_medias PRIMARY KEY(id, gamesId)
);
CONSTRAINT pk_medias PRIMARY KEY(gamesId, id)
) ENGINE=MyISAM;

ALTER TABLE medias ADD CONSTRAINT fk_medias_games FOREIGN KEY(gamesId) REFERENCES games(id);

Expand All @@ -91,4 +91,5 @@ CREATE TABLE IF NOT EXISTS comments(
);

ALTER TABLE comments ADD CONSTRAINT fk_comments_users FOREIGN KEY(usersId) REFERENCES users(id);
ALTER TABLE comments ADD CONSTRAINT fk_comments_games FOREIGN KEY(gamesId) REFERENCES games(id);
ALTER TABLE comments ADD CONSTRAINT fk_comments_games FOREIGN KEY(gamesId) REFERENCES games(id);

16 changes: 0 additions & 16 deletions void-eye-games-api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,4 @@ vendor
cache/*
cache/credentials.json
composer.lock
!assets/images/not-found.png
!assets/images/games/game-1.png
!assets/images/games/game-2.png
!assets/images/games/game-3.png
!assets/images/games/medias/1-1.png
!assets/images/games/medias/1-2.mp4
!assets/images/games/medias/2-3.webm
!assets/images/games/medias/2-4.png
!assets/images/games/medias/2-6.png
!assets/images/games/medias/3-5.jpg
!assets/images/games/medias/3-10.png
!assets/images/plataforms/plataform-1.png
!assets/images/plataforms/plataform-2.png
!assets/images/plataforms/plataform-3.png
!assets/images/plataforms/plataform-4.png
!assets/images/plataforms/plataform-5.png
assets/images/*
Binary file added void-eye-games-api/assets/images/games/game-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added void-eye-games-api/assets/images/games/game-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion void-eye-games-api/src/classes/Media/MediaTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class MediaTable extends Table
];

const PRIMARY_KEY = [
'id',
'gamesId',
'id',
];

const AUTOINC_COLUMN = 'id';
Expand Down
3 changes: 1 addition & 2 deletions void-eye-games-client/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
HTTPS=false
BUILD_PATH=../public
DOMAIN=http://voideyegame.com
DOMAIN=https://voideyegames.ddns.net
REACT_APP_BASEHOME=/VoidEyeGames/public/
REACT_APP_PUBLIC=$DOMAIN/VoidEyeGames
REACT_APP_PUBLIC_CLIENT=$REACT_APP_PUBLIC/public
Expand Down
5 changes: 5 additions & 0 deletions void-eye-games-client/src/domain/cache/CacheConfiguration.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { EventObserver } from "../EventObserver";

export const USERS_COUNT = "table.users.count";
export const CATEGORIES_COUNT = "table.categories.count";
export const PLATAFORMS_COUNT = "table.plataforms.count";
export const GAMES_COUNT = "table.games.count";
export const GAMES_LIMIT_PER_PAGE = "table.games.limit-per-page";

export const ON_CACHE_LOAD = "cache";

var cache = new Map();

export class CacheConfiguration {
static set(healthDetails) {
for (const key in healthDetails) {
cache[key] = healthDetails[key];
}
EventObserver.notify(ON_CACHE_LOAD);
}

static get(key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Game from "./Game";
import Plataform from "./Plataform";

class PlataformGame {
constructor(builder = {plataformsId: -1, gamesId: -1, price: 0.0, priceUnit: 'EURO', discount: 0.0, isEnabled: false, games: new Game(), plataforms: new Plataform()}) {
constructor(builder = {plataformsId: -1, gamesId: -1, price: 0.0, priceUnit: 'EURO', discount: 0.0, isEnabled: true, games: new Game(), plataforms: new Plataform()}) {
this.plataformsId = builder.plataformsId;
this.gamesId = builder.gamesId;
this.price = builder.price;
Expand Down
18 changes: 16 additions & 2 deletions void-eye-games-client/src/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import Skeleton from 'react-loading-skeleton';
import GameItemComponent from '../components/models/GameItemComponent';
import GameItemSliderComponent from '../components/models/GameItemSliderComponent';
import { CacheConfiguration, GAMES_COUNT, GAMES_LIMIT_PER_PAGE, ON_CACHE_LOAD } from '../domain/cache/CacheConfiguration';
import { EventObserver } from '../domain/EventObserver';
import { EVENT_SESSION_CHANGE } from '../domain/EventsEnum';
import { SessionManager } from '../domain/SessionManager';
Expand Down Expand Up @@ -32,6 +33,15 @@ class HomePage extends React.Component {
}
}

onCacheLoad() {
let gamesCount = CacheConfiguration.get(GAMES_COUNT);
let gamesLimit = CacheConfiguration.get(GAMES_LIMIT_PER_PAGE);
this.numOfPages = Math.floor(gamesCount / gamesLimit);
console.log(this.numOfPages);
this.setState({plataformsGames: []});
this.sendGamesRequest(this.numOfPages);
}

updateSliderGames(response) {
this.setState({sliderGames: response.data});
}
Expand All @@ -57,14 +67,18 @@ class HomePage extends React.Component {
}

componentDidMount() {
this.sendGamesRequest(1);
this.sendGamesRequest(2);
EventObserver.subscribe(ON_CACHE_LOAD, "HomePage", this.onCacheLoad.bind(this));
this.sendGamesRequest();
this.sendSliderGamesRequest();
if (SessionManager.check()) {
EventObserver.notify(EVENT_SESSION_CHANGE);
}
}

componentWillUnmount() {
EventObserver.unsubscribe(ON_CACHE_LOAD, "HomePage");
}

render() {
return (
<section className='w-100 h-100'>
Expand Down
Loading

0 comments on commit 74ce5cf

Please sign in to comment.