removed popular games endpoint

This commit is contained in:
Roman Cervantes 2020-10-21 16:02:41 -07:00
parent 62ec1ad600
commit 6f5198bddb
3 changed files with 2 additions and 67 deletions

View file

@ -202,34 +202,7 @@ exports.game = functions.https.onRequest((req, res) => {
data,
})
.then(({ data }) => { res.status(200).send(data) })
.catch((error) => { res.send(error) });
});
exports.popularGames = functions.https.onRequest((req, res) => {
res.set('Access-Control-Allow-Origin', "*")
const data = `fields
name,
screenshots.image_id,
popularity,
platforms.name;
limit 50;
where platforms = (48, 49, 130, 167, 169);
sort popularity desc;
`;
axios({
url: 'https://api-v3.igdb.com/games',
method: 'POST',
headers: {
'Accept': 'application/json',
'user-key': functions.config().igdbv3.key,
},
data,
})
.then(({ data }) => { res.status(200).send(data) })
.catch((error) => { res.send(error) });
.catch((error) => { res.status(400).send(error) });
});
exports.email = functions.https.onRequest((req, res) => {

View file

@ -9,7 +9,6 @@
:text-variant="nightMode ? 'white' : ''"
:border-variant="nightMode ? 'dark' : ''"
/>
<!-- background-image: linear-gradient(transparent, #222 50%), url(${ coverScreenshot }); -->
<b-container>
<boards />
<page-footer />
@ -28,37 +27,9 @@ export default {
Boards,
},
data() {
return {
activeTab: 0,
coverGame: null,
};
},
computed: {
...mapState(['user', 'settings']),
...mapState(['user']),
...mapGetters(['nightMode']),
coverScreenshot() {
const baseUrl = 'https://images.igdb.com/igdb/image/upload/t_1080p_2x/';
return this.coverGame && this.coverGame.screenshots.length
? `${baseUrl}${this.coverGame.screenshots[0].image_id}.jpg`
: '';
},
},
async mounted() {
const randomNumber = Math.floor(Math.random() * 49);
const popularGames = await this.$store.dispatch('LOAD_POPULAR_GAMES');
this.coverGame = popularGames[randomNumber];
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
.hero {
text-shadow: 2px 3px 5px rgba(0,0,0,0.5);
}
</style>

View file

@ -18,15 +18,6 @@ export default {
});
},
LOAD_POPULAR_GAMES() {
return new Promise((resolve, reject) => {
axios.get(`${API_BASE}/popularGames`)
.then(({ data }) => {
resolve(data);
}).catch(reject);
});
},
LOAD_BOARDS({ state, commit }) {
return new Promise((resolve, reject) => {
const db = firebase.firestore();