Skip to content

Commit

Permalink
Hotfix to functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
clj13001 committed Dec 4, 2016
1 parent 4d48735 commit 87c2014
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion html/javascript/listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function show(){
function getUnavailableItems(){
var unavailable = new Array;
var unavailable_str = localStorage.getItem('unavailable');
if(unavailable_str !== ""){
if(unavailable_str !== "" && unavailable_str !== null){
unavailable = JSON.parse(unavailable_str);
}
return unavailable;
Expand Down
4 changes: 2 additions & 2 deletions html/javascript/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function getCartItems(){
//get them from local storage
var cart_str = localStorage.getItem('cart');
//if there is at least one object already we need to convert it from JSON to string
if (cart_str !== null) {
if (cart_str !== null && cart_str !== "") {
cart = JSON.parse(cart_str);
}
return cart;
Expand All @@ -128,7 +128,7 @@ function getCartItems(){
function getUnavailableItems(){
var unavailable = new Array;
var unavailable_str = localStorage.getItem('unavailable');
if(unavailable_str !== ""){
if(unavailable_str !== "" && unavailable_str !== null){
unavailable = JSON.parse(unavailable_str);
}
return unavailable;
Expand Down
2 changes: 1 addition & 1 deletion html/javascript/return.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function getUnavailableIDs()
{
var unavailable = new Array;
var unavailable_str = localStorage.getItem('unavailable');
if(unavailable_str !== ""){
if(unavailable_str !== "" && unavailable_str !== null){
unavailable = JSON.parse(unavailable_str);
}
return unavailable;
Expand Down
2 changes: 1 addition & 1 deletion html/javascript/shoppingCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ This function gets unavailable items from local storage.
function getUnavailableItems(){
var unavailable = new Array; //make new array
var unavailable_str = localStorage.getItem('unavailable'); //get the string from local storage
if(unavailable_str !== ''){ //as long as its not null
if(unavailable_str !== '' && unavailable_str !== null){ //as long as its not null
unavailable = JSON.parse(unavailable_str); //make into array
}
return unavailable; //return value is an array
Expand Down

0 comments on commit 87c2014

Please sign in to comment.