Get dashboard in a more working state

This commit is contained in:
Dane Everitt 2018-06-05 23:42:34 -07:00
parent e948d81d8a
commit 5bcabbde35
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 69 additions and 47 deletions

View file

@ -1,3 +1,21 @@
export default class Server {
constructor({
identifier,
uuid,
name,
node,
description,
allocation,
limits,
feature_limits
}) {
this.identifier = identifier;
this.uuid = uuid;
this.name = name;
this.node = node;
this.description = description;
this.allocation = allocation;
this.limits = limits;
this.feature_limits = feature_limits;
}
}

View file

@ -1,25 +1,21 @@
import axios from './../helpers/axios';
export default class User {
/**
* Get a new user model by hitting the Panel API using the authentication token
* provided. If no user can be retrieved null will be returned.
*
* @param {string} token
* @param {string} cookie
* @return {User|null}
*/
static fromCookie(token, cookie = 'pterodactyl_session') {
window.axios.get('/api/client/account', {
headers: {
Cookie: `${cookie}=${token}`,
}
})
static fromCookie() {
axios.get('/api/client/account')
.then(response => {
return new User(response.data.attributes);
})
.catch(err => {
console.error(err);
return null;
})
});
}
/**