Nuxt
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.
 
 
 

32 lines
523 B

export const state = () => ({
list: [],
ip:''
})
export const mutations = {
add(state, text) {
state.list.push({
text: text,
done: false
})
},
remove(state, {
todo
}) {
state.list.splice(state.list.indexOf(todo), 1)
},
toggle(state, todo) {
todo.done = !todo.done
},
SET_IP(state, ip) {
state.ip = ip
}
}
export const actions={
async getIP ({ commit }) {
const ip = await this.$axios.$get('http://icanhazip.com')
commit('SET_IP', ip)
}
}