UNPKG

weather-bar-app

Version:

Weather Bar is a Weather Application that lives in your Menu Bar giving you beautiful access to real-time weather conditions and a generous 15-day forecast.

37 lines (32 loc) 680 B
const state = {} const mutations = { DELETE_WEATHER (state, data) { if (data.hasOwnProperty('hash_key')) { delete state[data.hash_key] } }, SAVE_WEATHER (state, data) { if (data.hasOwnProperty('hash_key')) { state[data.hash_key] = data } } } const getters = { getWeather: (state) => (hashKey) => { return (state.hasOwnProperty(hashKey)) ? state[hashKey] : null } } const actions = { deleteWeather ({ commit }, data) { commit('DELETE_WEATHER', data) }, saveWeather ({ commit }, data) { commit('SAVE_WEATHER', data) } } export default { state, mutations, getters, actions }