Issues (7)

src/models/storage.js (7 issues)

1
const storage = {
2
  storeToken: function storeToken(token) {
3
    localStorage.setItem("tokenDate", new Date().getTime());
0 ignored issues
show
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
7
  storeJWT: function storeToken(token, id) {
8
    localStorage.setItem("JWTDate", new Date().getTime());
0 ignored issues
show
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...
9
    localStorage.setItem("userID", id);
10
    localStorage.setItem("tokenJWT", token);
11
  },
12
13
  readJwtID: function readJwtID() {
14
    const id = localStorage.getItem("userID");
0 ignored issues
show
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...
15
    return id;
16
  },
17
18
  readToken: function readToken() {
19
    const token = localStorage.getItem("token");
0 ignored issues
show
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...
20
    const tokenDate = localStorage.getItem("tokenDate");
21
    const tokenObj = {
22
      token: token,
23
      date: tokenDate,
24
    };
25
    return tokenObj;
26
  },
27
28
  readJWT: function readToken() {
29
    const token = localStorage.getItem("tokenJWT");
0 ignored issues
show
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...
30
    const tokenDate = localStorage.getItem("JWTDate");
31
    const tokenObj = {
32
      token: token,
33
      date: tokenDate,
34
    };
35
    return tokenObj;
36
  },
37
38
  deleteToken: function readToken() {
39
    localStorage.removeItem("token");
0 ignored issues
show
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...
40
    localStorage.removeItem("tokenDate");
41
  },
42
43
  deleteJWT: function readToken() {
44
    localStorage.removeItem("tokenJWT");
0 ignored issues
show
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...
45
    localStorage.removeItem("JWTDate");
46
  },
47
};
48
49
export default storage;
50