1 |
class ServerStorage
|
1✔ |
2 |
{ |
1✔ |
3 |
constructor(request) |
1✔ |
4 |
{ |
1✔ |
5 |
this.request = request;
|
1✔ |
6 |
} |
1✔ |
7 |
|
1✔ |
8 |
async get(key) |
1✔ |
9 |
{ |
1✔ |
10 |
return this.request.session[key]; |
1✔ |
11 |
} |
1✔ |
12 |
|
1✔ |
13 |
async set(key, value) |
1✔ |
14 |
{ |
1✔ |
15 |
this.request.session[key] = value;
|
1✔ |
16 |
return value;
|
5✔ |
17 |
} |
1✔ |
18 |
|
1✔ |
19 |
async unset(key) |
1✔ |
20 |
{ |
1✔ |
21 |
if (this.request.session.hasOwnProperty(key)) { |
1✔ |
22 |
delete this.request.session[key]; |
1✔ |
23 |
return true; |
1✔ |
24 |
} |
1✔ |
25 |
return false; |
3✔ |
26 |
} |
1✔ |
27 |
|
1✔ |
28 |
} |
1✔ |
29 |
|
1✔ |
30 |
module.exports = ServerStorage; |
1✔ |