Disabled no recruting faction

fusion
Makaci Michael Gabriel ago%!(EXTRA string=1 year)
parent 057f445f26
commit 3b275c8bd4
  1. 18
      js/controllers/reg.js

@ -1,6 +1,6 @@
import { Auth } from "../skama_code/auth/auth.js";
import { My } from "../skama_code/api/agent.js";
import { Faction } from "../skama_code/api/faction.js"
import { Faction } from "../skama_code/api/faction.js";
import home from "./home.js";
import login from "./login.js";
import menu_mod from "./menu_mod.js";
@ -12,8 +12,14 @@ export default function reg(temp_engine) {
menu_mod(temp_engine);
Faction.list_all((factions) => {
factions.forEach(faction => {
const option = `<option>${faction.symbol}</option>`;
factions.forEach((faction) => {
let option;
if (faction.isRecruting) {
option = `<option>${faction.symbol}</option>`;
} else {
option = `<option disabled>${faction.symbol}</option>`;
}
$("#group-faction").append(option);
});
});
@ -33,7 +39,7 @@ export default function reg(temp_engine) {
temp_engine.add_event("#btn-log", "click", () => {
login(temp_engine);
})
});
});
auth.done((agent) => {
@ -43,10 +49,10 @@ export default function reg(temp_engine) {
auth.fail((errors) => {
$(".errors").html("");
errors.forEach(error => {
errors.forEach((error) => {
$(".errors").append(`<p>${error}</p>`);
});
})
});
temp_engine.render(`templates/auth/reg.html`);
}
Loading…
Cancel
Save