@ -17,7 +17,6 @@ export default (temp_engine) => {
add_factions(factions);
temp_engine.add_event("#btn-faction", "click", (e) => {
console.log(button);
const faction_symbol = $(e.target).attr("data-symbol");
const faction = factions.find((element) => {
return element.symbol == faction_symbol;
@ -13,8 +13,8 @@ export class Faction {
this.traits = data.traits;
}
get(callback, error_handler) {
const url = `${SpaceTraders.host}/factions/${this.name}`;
static get(name, callback, error_handler) {
const url = `${SpaceTraders.host}/factions/${name}`;
$.ajax({
url: url,
method: "GET",
@ -23,7 +23,7 @@ export class Faction {
Authorization: `Bearer ${My.agent.token}`,
},
success: (response) => {
callback(response);
callback(new Faction(response.data));
error: (err) => {
error_handler(err);