mirror of
https://github.com/romancm/gamebrary
synced 2025-02-17 19:48:24 +00:00
save igdb platforms to store
This commit is contained in:
parent
ae068f27cb
commit
1f655b9783
3 changed files with 21 additions and 1 deletions
|
@ -10,10 +10,11 @@ export default {
|
|||
// NEW STUFF
|
||||
//
|
||||
|
||||
LOAD_IGDB_PLATFORMS() {
|
||||
LOAD_IGDB_PLATFORMS({ commit }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${API_BASE}/platforms`)
|
||||
.then(({ data }) => {
|
||||
commit('SET_PLATFORMS', data);
|
||||
resolve(data);
|
||||
}).catch(reject);
|
||||
});
|
||||
|
|
|
@ -13,6 +13,24 @@ export default {
|
|||
state.board = board;
|
||||
},
|
||||
|
||||
SET_PLATFORMS(state, platforms) {
|
||||
const test = {};
|
||||
|
||||
platforms.forEach((platform) => {
|
||||
const formattedPlatform = {
|
||||
id: platform.id,
|
||||
name: platform.name,
|
||||
slug: platform.slug,
|
||||
category: platform.category,
|
||||
generation: platform.generation,
|
||||
};
|
||||
|
||||
test[platform.id] = formattedPlatform;
|
||||
});
|
||||
|
||||
state.platforms = test;
|
||||
},
|
||||
|
||||
SET_BOARD_GAMES(state, boardGames) {
|
||||
state.boardGames = boardGames;
|
||||
},
|
||||
|
|
|
@ -8,6 +8,7 @@ export default {
|
|||
gameLists: {},
|
||||
settings: null,
|
||||
platform: null,
|
||||
platforms: {},
|
||||
results: [],
|
||||
galleryOpen: false,
|
||||
games: {},
|
||||
|
|
Loading…
Add table
Reference in a new issue