Commit 1de052d6 authored by Tristan Cavelier's avatar Tristan Cavelier

fix localstorage.js little bugs

parent f84ef0ef
...@@ -84,7 +84,7 @@ var newLocalStorage = function (spec, my) { ...@@ -84,7 +84,7 @@ var newLocalStorage = function (spec, my) {
var doc; var doc;
doc = localstorage.getItem( doc = localstorage.getItem(
priv.localpath + "/" + command.getDocId()); priv.localpath + "/" + command.getDocId());
if (typeof doc === "undefined") { if (doc === null) {
// the document does not exists // the document does not exists
localstorage.setItem( localstorage.setItem(
priv.localpath + "/" + command.getDocId(), priv.localpath + "/" + command.getDocId(),
...@@ -113,12 +113,12 @@ var newLocalStorage = function (spec, my) { ...@@ -113,12 +113,12 @@ var newLocalStorage = function (spec, my) {
var doc; var doc;
doc = localstorage.getItem( doc = localstorage.getItem(
priv.localpath + "/" + command.getDocId()); priv.localpath + "/" + command.getDocId());
if (typeof doc === "undefined") { if (doc === null) {
// the document does not exists // the document does not exists
doc = command.cloneDoc(); doc = command.cloneDoc();
} else { } else {
// the document already exists // the document already exists
priv.documentObjectUpdate(doc, command.getDocId()); priv.documentObjectUpdate(doc, command.cloneDoc());
} }
// write // write
localstorage.setItem( localstorage.setItem(
...@@ -138,7 +138,7 @@ var newLocalStorage = function (spec, my) { ...@@ -138,7 +138,7 @@ var newLocalStorage = function (spec, my) {
var doc; var doc;
doc = localstorage.getItem( doc = localstorage.getItem(
priv.localpath + "/" + command.getDocId()); priv.localpath + "/" + command.getDocId());
if (typeof doc === "undefined") { if (doc === null) {
// the document does not exists // the document does not exists
that.error({ that.error({
"status": 404, "status": 404,
...@@ -187,7 +187,7 @@ var newLocalStorage = function (spec, my) { ...@@ -187,7 +187,7 @@ var newLocalStorage = function (spec, my) {
doc = localstorage.getItem( doc = localstorage.getItem(
priv.localpath + "/" + command.getDocId() + "/" + priv.localpath + "/" + command.getDocId() + "/" +
command.getAttachmentId()); command.getAttachmentId());
if (typeof doc !== "undefined") { if (doc !== null) {
that.success(doc); that.success(doc);
} else { } else {
that.error({ that.error({
...@@ -202,7 +202,7 @@ var newLocalStorage = function (spec, my) { ...@@ -202,7 +202,7 @@ var newLocalStorage = function (spec, my) {
// seeking for a document // seeking for a document
doc = localstorage.getItem( doc = localstorage.getItem(
priv.localpath + "/" + command.getDocId()); priv.localpath + "/" + command.getDocId());
if (typeof doc !== "undefined") { if (doc !== null) {
that.success(doc); that.success(doc);
} else { } else {
that.error({ that.error({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment