Correction fonction get de la classe Faction

michael
Makaci Michael Gabriel ago%!(EXTRA string=1 year)
parent 3a5f485c42
commit 5d94e4cc34
  1. 1
      js/controllers/faction.js
  2. 6
      js/skama_code/api/faction.js

@ -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);

Loading…
Cancel
Save