Load add-players page from API

This commit is contained in:
Garrett Mills 2020-11-05 22:00:33 -06:00
parent a207cd0a11
commit 9d3d614c20
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -1,6 +1,7 @@
import { Component } from '../../../lib/vues6.js' import { Component } from '../../../lib/vues6.js'
import { fake_players } from '../../module/fake_data.js' import { fake_players } from '../../module/fake_data.js'
import { clone } from '../../module/util.js' import { clone } from '../../module/util.js'
import { api } from '../../module/api.js'
const template = ` const template = `
<div class="page-add-players"> <div class="page-add-players">
@ -102,7 +103,15 @@ class AddPlayersComponent extends Component {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
async vue_on_create() { async vue_on_create() {
this.possible_players = [...this.all_players]; const available_players = await api.get_available_draft_players()
const team_players = await api.get_my_team_players()
this.all_players = this.possible_players = [...team_players, ...available_players].map(x => {
x.showing_stats = false;
return x;
});
this.my_team = [...team_players];
this.filtered_players = [...this.possible_players]; this.filtered_players = [...this.possible_players];
} }