diff --git a/src/session/sessions.ts b/src/session/sessions.ts index 10e12d6..33cdc18 100644 --- a/src/session/sessions.ts +++ b/src/session/sessions.ts @@ -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 * @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 + * @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 /**