@@ -48,8 +48,8 @@ class App extends Component {
48
48
} ;
49
49
50
50
componentDidMount ( ) {
51
- if ( window . localStorage ) {
52
- const cache = JSON . parse ( window . localStorage . getItem ( STORAGE_KEY ) ) ;
51
+ if ( window . sessionStorage ) {
52
+ const cache = JSON . parse ( window . sessionStorage . getItem ( STORAGE_KEY ) ) ;
53
53
if ( cache != null ) {
54
54
// eslint-disable-next-line react/no-did-mount-set-state
55
55
this . setState ( {
@@ -89,14 +89,14 @@ class App extends Component {
89
89
this . setState ( this . getInitialState ( ) ) ;
90
90
} ;
91
91
92
- removeLocalStorage = ( ) => {
93
- if ( window . localStorage ) window . localStorage . removeItem ( STORAGE_KEY ) ;
92
+ removeSessionStorage = ( ) => {
93
+ if ( window . sessionStorage ) window . sessionStorage . removeItem ( STORAGE_KEY ) ;
94
94
} ;
95
95
96
96
pushStateToStorage = ( ) => {
97
- this . removeLocalStorage ( ) ;
98
- if ( window . localStorage )
99
- window . localStorage . setItem ( STORAGE_KEY , JSON . stringify ( this . state ) ) ;
97
+ this . removeSessionStorage ( ) ;
98
+ if ( window . sessionStorage )
99
+ window . sessionStorage . setItem ( STORAGE_KEY , JSON . stringify ( this . state ) ) ;
100
100
} ;
101
101
102
102
addTicket = ticketData => {
@@ -165,7 +165,7 @@ class App extends Component {
165
165
message : 'Bus ištrinti bilietai ir kamuoliukų istorija.' ,
166
166
} ,
167
167
( ) => {
168
- this . removeLocalStorage ( ) ;
168
+ this . removeSessionStorage ( ) ;
169
169
this . resetState ( ) ;
170
170
}
171
171
) ;
0 commit comments