* Init Webpack / Babel / etc setup. * Build the app using Vue, Vue-router, Vuex. * i18n Some backends changes were made to match the webapp development: * Return the flat status as a single string ("new" rather than "FlatStatus.new") * Completely switch to calling Weboob API directly for fetching * Use Canister for Bottle logging * Handle merging of details dict better * Add a WSGI script * Keep track of duplicates * Webserver had to be restarted to fetch external changes to the db * Handle leboncoin module better Also add contributions guidelines. Closes issue #3 Closes issue #14.
35 lines
942 B
JavaScript
35 lines
942 B
JavaScript
import Vue from 'vue'
|
|
|
|
import * as types from './mutations-types'
|
|
|
|
export const state = {
|
|
flats: [],
|
|
timeToPlaces: []
|
|
}
|
|
|
|
export const mutations = {
|
|
[types.REPLACE_FLATS] (state, { flats }) {
|
|
state.flats = flats
|
|
},
|
|
[types.MERGE_FLATS] (state, { flats }) {
|
|
flats.forEach(flat => {
|
|
const flatIndex = state.flats.findIndex(storedFlat => storedFlat.id === flat.id)
|
|
|
|
if (flatIndex > -1) {
|
|
Vue.set(state.flats, flatIndex, flat)
|
|
} else {
|
|
state.flats.push(flat)
|
|
}
|
|
})
|
|
},
|
|
[types.UPDATE_FLAT_STATUS] (state, { flatId, newStatus }) {
|
|
const index = state.flats.findIndex(flat => flat.id === flatId)
|
|
if (index > -1) {
|
|
Vue.set(state.flats[index], 'status', newStatus)
|
|
}
|
|
},
|
|
[types.RECEIVE_TIME_TO_PLACES] (state, { timeToPlaces }) {
|
|
state.timeToPlaces = timeToPlaces
|
|
}
|
|
}
|