summaryrefslogtreecommitdiff
path: root/src/RouterParamMixin.js
blob: cf4292042137f555e914dcd006d8e3b84bc41df0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as maps from './maps/maps';

export default {
  computed: {
    playersPerMatch: function() {
      return maps.playersPerMatch(this.selectedMode);
    },
    hasTalents: function() {
      return maps.hasTalents(this.selectedMode);
    },
    selectedActor: {
      get: function() {
        return this.$route.query.actor || '*Kinetic*';
      },
      set: function(value) {
        this.$ga.event('Hero', 'update', value);
        const query = Object.assign({}, this.$route.query, { actor: value });
        this.$router.push({ query });
      },
    },
    selectedMode: {
      get: function() {
        return this.$route.query.mode || 'blitz_pvp_ranked';
      },
      set: function(value) {
        this.$ga.event('Mode', 'update', value);
        const query = Object.assign({}, this.$route.query, { mode: value });
        this.$router.push({ query });
      },
    },
    filterRarity: {
      get: function() {
        return this.$route.query.rarity || '';
      },
      set: function(value) {
        this.$ga.event('Rarity', 'update', value);
        const query = Object.assign({}, this.$route.query, { rarity: value });
        this.$router.push({ query });
      },
    },
    filterName: {
      get: function() {
        return this.$route.query.search || '';
      },
      set: function(value) {
        this.$ga.event('Search', 'update', value);
        const query = Object.assign({}, this.$route.query, { search: value });
        this.$router.push({ query });
      },
    },
    filterLowPickrate: {
      get: function() {
        return this.$route.query.lowPickrate == true;
      },
      set: function(value) {
        this.$ga.event('LowPickrate', 'update', value);
        const query = Object.assign({}, this.$route.query, { lowPickrate: value });
        this.$router.push({ query });
      },
    },
  },
};