frontend/src/services/localStorage.js
//Value === object or array for to include in field
Value === object or array for to include in field
Value === object or array for to include in field
function includeField(field, value) {
    if (checkLocalStorage === false) {
        return false
    }
    internalLocalStorage = JSON.parse(localStorage.getItem(nameLocalStorage));
    Object.keys(internalLocalStorage).forEach(data => {
        if (data === field) {
            if (data === "personalInformation") {
                internalLocalStorage.personalInformation = value
            }
            else {
                let internalArray = [...internalLocalStorage[`${data}`]]
                internalArray.push(value);
                internalLocalStorage[`${data}`] = internalArray;
            }
            localStorage.setItem(nameLocalStorage, JSON.stringify(internalLocalStorage));
        }
    })
}
function includeField ( field , value ) { if ( checkLocalStorage === false ) { return false } internalLocalStorage = JSON . parse ( localStorage . getItem ( nameLocalStorage ) ) ; Object . keys ( internalLocalStorage ) . forEach ( data => { if ( data === field ) { if ( data === "personalInformation" ) { internalLocalStorage . personalInformation = value } else { let internalArray = [ ... internalLocalStorage [ ` ${ data } ` ] ] internalArray . push ( value ) ; internalLocalStorage [ ` ${ data } ` ] = internalArray ; } localStorage . setItem ( nameLocalStorage , JSON . stringify ( internalLocalStorage ) ) ; } } ) }
Value === object or array for to include in field
Value === object or array for to include in field