A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/markerikson/project-minimek/commit/da9dcbf1b6de59468c42b417ee5a0ea8e64be3dc below:

Add factions to sample data and parse them · markerikson/project-minimek@da9dcbf · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+14

-3

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+14

-3

lines changed Original file line number Diff line number Diff line change

@@ -10,19 +10,20 @@ export function loadData(state, payload) {

10 10

// Create a Redux-ORM session from our entities "tables"

11 11

const session = orm.session(state);

12 12

// Get a reference to the correct version of model classes for this Session

13 -

const {Unit, Pilot, Mech, MechDesign} = session;

13 +

const {Unit, Faction, Pilot, Mech, MechDesign} = session;

14 14 15 -

const {unit, designs} = payload;

15 +

const {unit, factions, designs} = payload;

16 16 17 17

// Clear out any existing models from state so that we can avoid

18 18

// conflicts from the new data coming in if data is reloaded

19 -

[Unit, Pilot, Mech, MechDesign].forEach(modelType => {

19 +

[Unit, Faction, Pilot, Mech, MechDesign].forEach(modelType => {

20 20

modelType.all().toModelArray().forEach(model => model.delete());

21 21

});

22 22 23 23

// Immutably update the session state as we insert items

24 24

Unit.parse(unit);

25 25 26 +

factions.forEach(faction => Faction.parse(faction));

26 27

designs.forEach(design => MechDesign.parse(design));

27 28 28 29

// Return the new "tables" object containing the updates

Original file line number Diff line number Diff line change

@@ -227,6 +227,16 @@ const sampleData = {

227 227

},

228 228

],

229 229 230 +

factions : [

231 +

{id : "cc", name : "Capellan Confederation"},

232 +

{id : "dc", name : "Draconis Combine"},

233 +

{id : "elh", name : "Eridani Light Horse"},

234 +

{id : "fs", name : "Federated Suns"},

235 +

{id : "fwl", name : "Free Worlds League"},

236 +

{id : "hr", name : "Hansen's Roughriders"},

237 +

{id : "lc", name : "Lyran Commonwealth"},

238 +

{id : "wd", name : "Wolf's Dragoons"},

239 +

]

230 240

};

231 241 232 242

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4