Redux Actions - sonataFarm/lost_in_wiki GitHub Wiki

Page Actions

  • requestBackendPage: Takes a page title. Queries the backend db for all data about the page matching that title, then dispatches it through receiveBackendPage. So far it returns a title, id, and page_rank. The former two are useless at this point. More may come. As of now this isn't being used.

  • requestPageRanks: Takes an arbitrarily long array of titles. Queries the database for all pages with titles matching something in the array. Returns an array of objects with title and pageRank properties. Dispatches these to the relevant objects in pages.

  • requestPageLinks, requestPageSummary, requestMainImage, requestImages: Call Wikipedia's API for the relevant data, dispatches them to the state.

  • getUsableLinks: Takes a title and a difficulty, where difficulty is a pageRank. Returns the page's 30 highest-ranked pages below the max-rank specified by the difficulty. Only returns links for pages found in the backend DB.

Game Actions

  • updateCurrentPage. Takes a title, sets that title as the currentPage.

  • updateFocusPage: Takes a title, sets that title as the focusPage.

  • startNewGame: Takes an origin, destination, and a difficulty. Initializes the game state to these values, playing to true and won to false.

  • finishGame: Takes no params. Sets won to true and playing to false.

NB: won and playing are distinct values. This is because we want to initialize the StarField without having values like currentPage. See star-field docs.