move APIToken to different file

This commit is contained in:
b1ek 2023-05-17 03:21:15 +10:00
parent 1f417fdf12
commit 81c1cc57ad
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 30 additions and 27 deletions

View File

@ -0,0 +1,30 @@
import { IAPIObject } from "./IAPIObject";
class APIToken extends IAPIObject {
static storage_key = 'pairent_api_key';
constructor(data) {
super();
this.user = data.user;
this.key = data.key;
this.expires = data.expires;
this.ip = data.ip;
}
/** @type {number} */
user;
/** @type {string} */
key;
/** A Unix timestamp (when the token will expire)
* @type {number}
*/
expires;
/** @type {string} */
ip;
}
export { APIToken };

View File

@ -16,33 +16,6 @@ class UserLoginResponse {
id;
}
class APIToken extends IAPIObject {
static storage_key = 'pairent_api_key';
constructor(data) {
super();
this.user = data.user;
this.key = data.key;
this.expires = data.expires;
this.ip = data.ip;
}
/** @type {number} */
user;
/** @type {string} */
key;
/** A Unix timestamp (when the token will expire)
* @type {number}
*/
expires;
/** @type {string} */
ip;
}
class User extends IAPIObject {
isLoggedIn() {