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); add_factions(factions);
temp_engine.add_event("#btn-faction", "click", (e) => { temp_engine.add_event("#btn-faction", "click", (e) => {
console.log(button);
const faction_symbol = $(e.target).attr("data-symbol"); const faction_symbol = $(e.target).attr("data-symbol");
const faction = factions.find((element) => { const faction = factions.find((element) => {
return element.symbol == faction_symbol; return element.symbol == faction_symbol;

@ -13,8 +13,8 @@ export class Faction {
this.traits = data.traits; this.traits = data.traits;
} }
get(callback, error_handler) { static get(name, callback, error_handler) {
const url = `${SpaceTraders.host}/factions/${this.name}`; const url = `${SpaceTraders.host}/factions/${name}`;
$.ajax({ $.ajax({
url: url, url: url,
method: "GET", method: "GET",
@ -23,7 +23,7 @@ export class Faction {
Authorization: `Bearer ${My.agent.token}`, Authorization: `Bearer ${My.agent.token}`,
}, },
success: (response) => { success: (response) => {
callback(response); callback(new Faction(response.data));
}, },
error: (err) => { error: (err) => {
error_handler(err); error_handler(err);

Loading…
Cancel
Save