Get dashboard in a more working state
This commit is contained in:
parent
e948d81d8a
commit
5bcabbde35
10 changed files with 69 additions and 47 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue