0
0
Fork 0

Move userAgent getting to VueX

This commit is contained in:
Oliver-Akins 2021-03-29 14:10:53 -06:00
parent bc94ea898f
commit 0b3121bfe5
2 changed files with 11 additions and 8 deletions

View file

@ -45,7 +45,7 @@
If you are on one of those devices and you still see this message, If you are on one of those devices and you still see this message,
please contact "ghostwriter{at}resonym.com" with the following information: please contact "ghostwriter{at}resonym.com" with the following information:
<br><br> <br><br>
{{ userAgent }} {{ $store.getters.userAgent }}
</p> </p>
</div> </div>
</div> </div>
@ -76,14 +76,8 @@ export default {
gameState() { gameState() {
return this.$store.state.view; return this.$store.state.view;
}, },
userAgent() {
if (navigator == null) {
return "Navigator Undefined";
};
return navigator.userAgent;
},
isMobile () { isMobile () {
return this.userAgent.match(/(Navigator Undefined)|iPhone|iPod|Android/) != null; return this.$store.getters.userAgent.match(/(Navigator Undefined)|iPhone|iPod|Android/) != null;
}, },
}, },
methods: { methods: {

View file

@ -51,6 +51,15 @@ export default new Vuex.Store({
}; };
return ``; return ``;
}, },
userAgent() {
if (navigator == null) {
return "Navigator Undefined";
};
return navigator.userAgent;
},
isFirefox(state, getters) {
return getters.userAgent.match(/(Navigator Undefined)|Firefox/g) != null;
},
}, },
mutations: { mutations: {
resetState(state) { resetState(state) {