Passed
Push — dev ( 6ff2c1...2c3565 )
by Kasper
02:29 queued 13s
created

src/models/storage.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 21
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
mnd 0
bc 0
fnc 3
dl 0
loc 21
rs 10
bpm 0
cpm 1
noi 3
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A storage.js ➔ readToken 0 9 1
A storage.js ➔ storeToken 0 4 1
1
const storage = {
2
  storeToken: function storeToken(token) {
3
    localStorage.setItem("tokenDate", new Date().getTime());
0 ignored issues
show
Bug introduced by
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
    localStorage.setItem("token", token);
5
  },
6
  readToken: function readToken() {
7
    const token = localStorage.getItem("token");
0 ignored issues
show
Bug introduced by
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
8
    const tokenDate = localStorage.getItem("tokenDate");
9
    const tokenObj = {
10
      token: token,
11
      date: tokenDate,
12
    };
13
    return tokenObj;
14
  },
15
  deleteToken: function readToken() {
16
    localStorage.removeItem("token");
0 ignored issues
show
Bug introduced by
The variable localStorage seems to be never declared. If this is a global, consider adding a /** global: localStorage */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
17
    localStorage.removeItem("tokenDate");
18
  },
19
};
20
21
export default storage;
22