- fix: Date problems... (it was a bad "copy" function, the object date was not valid...
- fix: error fetch on loading... (offline appeared)
This commit is contained in:
@@ -31,9 +31,12 @@ async function sendRequest(url: string, lang: string, mytok: string, method: str
|
||||
method: method,
|
||||
cache: 'no-cache',
|
||||
mode: 'cors',
|
||||
body: JSON.stringify(mydata),
|
||||
headers: authHeader
|
||||
}
|
||||
|
||||
if (mydata !== null)
|
||||
configInit.body = JSON.stringify(mydata)
|
||||
|
||||
}
|
||||
|
||||
const request: Promise<Response> = fetch(url, configInit)
|
||||
|
||||
@@ -107,8 +107,10 @@ export namespace ApiTool {
|
||||
return resolve({ res, body })
|
||||
})
|
||||
.catch(e => {
|
||||
UserStore.mutations.setServerCode(rescodes.ERR_GENERICO)
|
||||
return reject({ code: rescodes.ERR_GENERICO, status: res.status })
|
||||
return resolve({ res, body: {} })
|
||||
// Array not found...
|
||||
// UserStore.mutations.setServerCode(rescodes.ERR_GENERICO)
|
||||
// return reject({ code: rescodes.ERR_GENERICO, status: res.status })
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@@ -278,6 +278,8 @@ namespace Actions {
|
||||
|
||||
const token = UserStore.state.idToken
|
||||
|
||||
console.log('TODO TO SAVE: ', itemtodo)
|
||||
|
||||
let res = await Api.SendReq(call, UserStore.state.lang, token, method, itemtodo)
|
||||
.then(({ res, newItem }) => {
|
||||
console.log('dbInsertSaveTodo RIS =', newItem)
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Mutations {
|
||||
state.category = data.categorySel
|
||||
// @ts-ignore
|
||||
state.tokens = [
|
||||
{ access: 'auth', token: data.idToken }
|
||||
{ access: 'auth ' + navigator.userAgent, token: data.idToken, date_login: new Date() }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Mutations {
|
||||
if (!state.tokens) {
|
||||
state.tokens = []
|
||||
}
|
||||
state.tokens.push({ access: 'auth', token: data.idToken })
|
||||
state.tokens.push({ access: 'auth ' + navigator.userAgent, token: data.idToken, data_login: new Date() })
|
||||
}
|
||||
|
||||
function setServerCode(state: IUserState, num: number) {
|
||||
@@ -143,6 +143,7 @@ namespace Mutations {
|
||||
if (state.servercode !== rescodes.ERR_SERVERFETCH) {
|
||||
state.servercode = err
|
||||
}
|
||||
console.log('Err catch: (servercode:', err, ')')
|
||||
}
|
||||
|
||||
function getMsgError(state: IUserState, err: number) {
|
||||
|
||||
Reference in New Issue
Block a user