- Update the way to use the data records on Vuex with Getters!

- Fix: mongodb call passing array todos and categiroes already splitted
This commit is contained in:
Paolo Arena
2019-02-27 02:58:41 +01:00
parent 0e98ac1eaa
commit fa17de24f0
60 changed files with 3133 additions and 1839 deletions

View File

@@ -7,7 +7,7 @@ import axios from 'axios'
export { addAuthHeaders, removeAuthHeaders, API_URL } from './Instance'
// import {AlgoliaSearch} from './AlgoliaController'
import Paths from '@paths'
import { rescodes } from '@src/store/Modules/rescodes'
import { tools } from '@src/store/Modules/tools'
import { GlobalStore, UserStore } from '@modules'
import globalroutines from './../../globalroutines/index'
@@ -62,7 +62,7 @@ export namespace ApiTool {
}
export async function SendReq(url: string, method: string, mydata: any, setAuthToken: boolean = false): Promise<Types.AxiosSuccess | Types.AxiosError> {
UserStore.mutations.setServerCode(rescodes.EMPTY)
UserStore.mutations.setServerCode(tools.EMPTY)
UserStore.mutations.setResStatus(0)
return await new Promise(function (resolve, reject) {
@@ -85,10 +85,10 @@ export namespace ApiTool {
if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
// Forbidden
// You probably is connectiong with other page...
UserStore.mutations.setServerCode(rescodes.ERR_AUTHENTICATION)
UserStore.mutations.setServerCode(tools.ERR_AUTHENTICATION)
UserStore.mutations.setAuth('')
router.push('/signin')
return reject({ code: rescodes.ERR_AUTHENTICATION })
return reject({ code: tools.ERR_AUTHENTICATION })
}
return resolve(res)
@@ -147,7 +147,7 @@ export namespace ApiTool {
if (method !== 'POST')
link += '/' + rec._id
console.log(' [Alternative] ++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
// console.log(' [Alternative] ++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
// Insert/Delete/Update table to the server
return SendReq(link, method, rec)