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 throughreceiveBackendPage
. So far it returns atitle
,id
, andpage_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 withtitle
andpageRank
properties. Dispatches these to the relevant objects inpages
. -
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 thecurrentPage
. -
updateFocusPage
: Takes a title, sets that title as thefocusPage
. -
startNewGame
: Takes an origin, destination, and a difficulty. Initializes thegame
state to these values,playing
totrue
andwon
to false. -
finishGame
: Takes no params. Setswon
totrue
andplaying
tofalse
.
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.