You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import {createStore} from 'vuex'
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
|
|
export default createStore({
|
|
|
|
|
state: {
|
|
|
|
|
player: null,
|
|
|
|
|
inventory: []
|
|
|
|
|
},
|
|
|
|
|
getters: {},
|
|
|
|
|
mutations: {
|
|
|
|
|
fetchUser(state) {
|
|
|
|
|
let existingUserUuid = localStorage.getItem('farmfresh_uuid');
|
|
|
|
|
|
|
|
|
|
if (existingUserUuid != null) {
|
|
|
|
|
axios.get(
|
|
|
|
|
'http://api.luna-development.net/api/player/fetch/'+existingUserUuid
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if (response.data && response.data.uuid) {
|
|
|
|
|
state.player = response.data;
|
|
|
|
|
} else {
|
|
|
|
|
alert('User not found');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
actions: {},
|
|
|
|
|
modules: {}
|
|
|
|
|
})
|