fix "Todo Completati"

statics instead of assets
This commit is contained in:
Paolo Arena
2019-03-05 23:44:48 +01:00
parent 6686e44297
commit 41edd96c8c
35 changed files with 184 additions and 2983 deletions

View File

@@ -4,7 +4,8 @@ import * as Types from '@src/store/Api/ApiTypes'
async function sendRequest(url: string, method: string, mydata: any) {
console.log('sendRequest', method, url)
if (!process.env.DEBUG)
console.log('sendRequest', method, url)
let request
if (method === 'GET')

View File

@@ -17,12 +17,14 @@ export const axiosInstance: AxiosInstance = axios.create({
axiosInstance.interceptors.response.use(
(response) => {
console.log(response)
if (process.env.DEBUG === '1')
console.log(response)
return response
},
(error) => {
if (error.response) {
console.log(error.response.status)
if (process.env.DEBUG === '1')
console.log(error.response.status)
console.log('Request Error: ', error.response)
}
return Promise.reject(error)

View File

@@ -7,7 +7,7 @@ import translate from './../../globalroutines/util'
import urlBase64ToUint8Array from '../../js/utility'
import messages from '../../assets/i18n'
import messages from '../../statics/i18n'
import { GlobalStore, Todos, UserStore } from '@store'
import globalroutines from './../../globalroutines/index'
import Api from '@api'
@@ -62,11 +62,15 @@ async function getConfig(id) {
async function getstateConnSaved() {
const config = await getConfig(costanti.CONFIG_ID_CFG)
console.log('config', config)
if (config.length > 1) {
const cfgstateconn = config[1]
return cfgstateconn.stateconn
if (config) {
if (config.length > 1) {
const cfgstateconn = config[1]
return cfgstateconn.stateconn
} else {
return 'online'
}
} else {
return 'online'
return 'offline'
}
}
@@ -84,12 +88,12 @@ namespace Getters {
const testpao1_getter_array = b.read(state => param1 => state.testp1.mioarray.filter(item => item).map(item => item.valore), 'testpao1_getter_array')
const getConfigbyId = b.read(state => id => state.arrConfig.find(item => item._id === id), 'getConfigbyId')
const getConfigStringbyId = b.read(state => id => {
const config = state.arrConfig.find(item => item._id === id)
const getConfigStringbyId = b.read(state => params => {
const config = state.arrConfig.find(item => item._id === params.id)
if (config) {
return config.value
} else {
return ''
return params.default
}
}, 'getConfigStringbyId')
@@ -199,15 +203,18 @@ namespace Mutations {
}
function setShowType(state: IGlobalState, showtype: number) {
// console.log('setShowType', showtype)
console.log('setShowType', showtype)
const config = Getters.getters.getConfigbyId(costanti.CONFIG_ID_SHOW_TYPE_TODOS)
// console.log('config', config)
console.log('config', config)
if (config) {
config.value = String(showtype)
Todos.state.showtype = parseInt(config.value)
// console.log('Todos.state.showtype', Todos.state.showtype)
GlobalStore.mutations.saveConfig({ _id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, value: String(showtype) })
} else {
Todos.state.showtype = showtype
}
console.log('Todos.state.showtype', Todos.state.showtype)
GlobalStore.mutations.saveConfig({ _id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, value: String(showtype) })
}
export const mutations = {

View File

@@ -404,7 +404,8 @@ namespace Actions {
return sendSwMsgIfAvailable()
.then(something => {
if (something) {
console.log('something')
if (process.env.DEBUG === '1')
console.log('something')
// Refresh data
return waitAndRefreshData(context)
}
@@ -482,13 +483,13 @@ namespace Actions {
// console.log('PRIMA showtype = ', state.showtype)
state.showtype = parseInt(GlobalStore.getters.getConfigStringbyId(costanti.CONFIG_ID_SHOW_TYPE_TODOS))
state.showtype = parseInt(GlobalStore.getters.getConfigStringbyId({id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, default: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED }))
// console.log('showtype = ', state.showtype)
// console.log('ARRAY TODOS = ', state.todos)
console.log('dbLoadTodo', 'state.todos', state.todos, 'state.categories', state.categories)
if (process.env.DEBUG === '1')
console.log('dbLoadTodo', 'state.todos', state.todos, 'state.categories', state.categories)
return res
})
@@ -499,7 +500,8 @@ namespace Actions {
})
if (ris.status !== 200) {
console.log('ris.status', ris.status)
if (process.env.DEBUG === '1')
console.log('ris.status', ris.status)
if (ris.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
consolelogpao('UNAUTHORIZING... TOKEN EXPIRED... !! ')
} else {

View File

@@ -367,7 +367,7 @@ namespace Actions {
}
async function signin(context, authData: ISigninOptions) {
console.log('LOGIN signin')
// console.log('LOGIN signin')
// console.log('MYLANG = ' + state.lang)
@@ -406,8 +406,8 @@ namespace Actions {
}
// console.log('PASSO 4')
console.log(usertosend)
if (process.env.DEBUG === '1')
console.log(usertosend)
Mutations.mutations.setServerCode(tools.CALLING)