Skip to content

Commit

Permalink
#172 - total seconds now in session storage
Browse files Browse the repository at this point in the history
  • Loading branch information
bracyw committed Aug 23, 2024
1 parent fbac39a commit 74909ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils';
export default class ActiveStatus {
isActive: boolean = false;
currentSeconds: number = 0;
totalSeconds: number = Number(localStorage.getItem('active total seconds')) || 0;
totalSeconds: number = Number(sessionStorage.getItem('active total seconds')) || 0;
intervalId!: NodeJS.Timeout;
constructor(private storage: Storage) {}

Expand All @@ -35,7 +35,7 @@ export default class ActiveStatus {
this.intervalId = setInterval(() => {
this.currentSeconds++;
this.totalSeconds++;
localStorage.setItem('active total seconds', this.totalSeconds.toString());
sessionStorage.setItem('active total seconds', this.totalSeconds.toString());
}, 1000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils';
export default class BalancingStatus {
isBalancing: boolean = false;
currentSeconds: number = 0;
totalSeconds: number = Number(localStorage.getItem('balancing total seconds')) || 0;
totalSeconds: number = Number(sessionStorage.getItem('balancing total seconds')) || 0;
intervalId!: NodeJS.Timeout;
constructor(private storage: Storage) {}

Expand All @@ -35,7 +35,7 @@ export default class BalancingStatus {
this.intervalId = setInterval(() => {
this.currentSeconds++;
this.totalSeconds++;
localStorage.setItem('balancing total seconds', this.totalSeconds.toString());
sessionStorage.setItem('balancing total seconds', this.totalSeconds.toString());
}, 1000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils';
export default class ChargingStatusComponent {
isCharging: boolean = false;
currentSeconds: number = 0;
totalSeconds: number = Number(localStorage.getItem('charging total seconds')) || 0;
totalSeconds: number = Number(sessionStorage.getItem('charging total seconds')) || 0;
intervalId!: NodeJS.Timeout;

constructor(private storage: Storage) {}
Expand All @@ -36,7 +36,7 @@ export default class ChargingStatusComponent {
this.intervalId = setInterval(() => {
this.currentSeconds++;
this.totalSeconds++;
localStorage.setItem('charging total seconds', this.totalSeconds.toString());
sessionStorage.setItem('charging total seconds', this.totalSeconds.toString());
}, 1000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils';
export default class FaultedStatus {
isFaulted: boolean = false;
currentSeconds: number = 0;
totalSeconds: number = Number(localStorage.getItem('faulted total seconds')) || 0;
totalSeconds: number = Number(sessionStorage.getItem('faulted total seconds')) || 0;
intervalId!: NodeJS.Timeout;
constructor(private storage: Storage) {}

Expand All @@ -35,7 +35,7 @@ export default class FaultedStatus {
this.intervalId = setInterval(() => {
this.currentSeconds++;
this.totalSeconds++;
localStorage.setItem('faulted total seconds', this.totalSeconds.toString());
sessionStorage.setItem('faulted total seconds', this.totalSeconds.toString());
}, 1000);
}

Expand Down

0 comments on commit 74909ef

Please sign in to comment.