Небольшие доработки
This commit is contained in:
@@ -205,6 +205,7 @@ class ServerStorage extends Vue {
|
||||
if (tries >= maxSetTries) {
|
||||
//отменять изменения не будем, просто предупредим
|
||||
//this.commit('reader/setSettings', this.oldSettings);
|
||||
console.error(result);
|
||||
this.error('Не удалось отправить настройки на сервер. Данные не сохранены и могут быть перезаписаны.');
|
||||
} else {
|
||||
this.oldSettings = _.cloneDeep(this.settings);
|
||||
@@ -279,6 +280,7 @@ class ServerStorage extends Vue {
|
||||
if (tries >= maxSetTries) {
|
||||
this.commit('reader/setProfiles', this.oldProfiles);
|
||||
this.checkCurrentProfile();
|
||||
console.error(result);
|
||||
this.error('Не удалось отправить данные на сервер. Изменения отменены.');
|
||||
} else {
|
||||
this.oldProfiles = _.cloneDeep(this.profiles);
|
||||
|
||||
@@ -39,8 +39,8 @@ class ReaderController extends BaseController {
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
}
|
||||
//bad request
|
||||
res.status(400).send({error});
|
||||
//error
|
||||
res.status(500).send({error});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,11 +84,19 @@ class ReaderStorage {
|
||||
}
|
||||
|
||||
const dbh = await this.storagePool.get();
|
||||
await dbh.run('BEGIN');
|
||||
try {
|
||||
const newRev = {};
|
||||
for (const id of Object.keys(items)) {
|
||||
await dbh.run(SQL`INSERT OR REPLACE INTO storage (id, rev, time, data) VALUES (${id}, ${items[id].rev}, strftime('%s','now'), ${items[id].data})`);
|
||||
this.cache[id] = {rev: items[id].rev};
|
||||
newRev[id] = {rev: items[id].rev};
|
||||
}
|
||||
await dbh.run('COMMIT');
|
||||
|
||||
Object.assign(this.cache, newRev);
|
||||
} catch (e) {
|
||||
await dbh.run('ROLLBACK');
|
||||
throw e;
|
||||
} finally {
|
||||
dbh.ret();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user