generated from aichner/react-mdb-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from snek-at/improve-structure-aa1
Improve structure aa1 to master
- Loading branch information
Showing
2 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,31 +63,19 @@ class GithubSession extends Session { | |
} | ||
} | ||
|
||
/** @class A SNEK SubSession */ | ||
class SnekSession extends Session { | ||
/** @class CookieSession extends token session handling with cookies */ | ||
class CookieSession extends Session { | ||
refreshTokenName: string = "refresh"; | ||
/* Define tasks */ | ||
public tasks: SnekTasks; | ||
|
||
/** | ||
* Initializes a SNEK session. | ||
* Initializes a cookie session. | ||
* | ||
* @constructor | ||
* @author Nico Schett <[email protected]> | ||
* @param {string} sId A session name | ||
* @param {Endpoint} ep A endpoint | ||
* @param {SnekTemplate} template A template set | ||
*/ | ||
constructor( | ||
sId: string, | ||
public ep: ApolloEndpoint, | ||
public template: SnekTemplate | ||
) { | ||
constructor(sId: string) { | ||
super(sId); | ||
|
||
this.tokenName = sId + "-" + this.tokenName; | ||
this.refreshTokenName = sId + "-" + this.refreshTokenName; | ||
this.tasks = new SnekTasks(this); | ||
} | ||
|
||
//> Getter | ||
|
@@ -149,6 +137,33 @@ class SnekSession extends Session { | |
Cookies.remove(this.refreshTokenName); | ||
} | ||
} | ||
} | ||
|
||
/** @class A SNEK SubSession */ | ||
class SnekSession extends CookieSession { | ||
/* Define tasks */ | ||
public tasks: SnekTasks; | ||
|
||
/** | ||
* Initializes a SNEK session. | ||
* | ||
* @constructor | ||
* @author Nico Schett <[email protected]> | ||
* @param {string} sId A session name | ||
* @param {Endpoint} ep A endpoint | ||
* @param {SnekTemplate} template A template set | ||
*/ | ||
constructor( | ||
sId: string, | ||
public ep: ApolloEndpoint, | ||
public template: SnekTemplate | ||
) { | ||
super(sId); | ||
|
||
this.tokenName = sId + "-" + this.tokenName; | ||
this.refreshTokenName = sId + "-" + this.refreshTokenName; | ||
this.tasks = new SnekTasks(this); | ||
} | ||
|
||
//> Methods | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters