new github()
The github store module handles GitHub login and build status checks.
Members
-
static Getters :Object
-
Name Returns Type Returns State Property Description lastError
Error errors
Returns the most recent error encountered. login
string user.login
Returns the current user's login name. loginInProgress
boolean loginInProgress
Whether a login attempt is currently in progress. code
string The current GitHub login code. token
string The current GitHub authorisation token. -
static Mutations :Object
-
Name Accepts Type Mutates State Property Description setUser
Object user
Set the currently logged in user. setLoginFlag
boolean loginInProgress
Set the login in progress flag. addBuildStatusCheck
number buildStatusChecks
Schedule a build status check for a time in the future. removeBuildStatusCheck
buildStatusChecks
Mark the first scheduled build status check as complete. updateBuildStatus
GHBuildStatus buildStatus
Set the last build status. addError
Error errors
Add an error to the error list. -
static State
-
Properties:
Name Type Description user
null | Object The currently logged in user. errors
Array.<Error> List of errors encountered. loginInProgress
boolean Whether a login request is in progress. buildStatusChecks
Array.<number> When build status checks are scheduled in the future. lastBuildStatusCheck
null | number When the last build status check was conducted. buildStatus
null | GHBuildStatus The result of the last build status check.
Methods
-
action getBuildStatus(nsContext) → {Promise.<void>}
-
Execute a build status check.
Vuex Action => Mutates state propertybuildStatus,buildStatusChecks
Parameters:
Name Type Description nsContext
StoreContext Returns:
Promise.<void> -
action getUserDetails(nsContext) → {Promise.<void>}
-
Retrieve the details of the logged in user from GitHub. On success, triggers the workshop module's GitHub search for the user's UKRN workshop repositories.
Vuex Action => Mutates state propertyuser,loginInProgress,workshop.repositories
Parameters:
Name Type Description nsContext
StoreContext Throws:
If the user details cannot be retrieved, this function triggers a logout operation.Returns:
Promise.<void> -
action logout()
-
Trigger a logout operation by directing the window to the base page. Login information is controlled by querystring information, so wiping this from the location bar logs the user out. Because this triggers a window redirect, it should never return.
Vuex Action => Mutates state propertynone
-
action processToken(nsContext, token)
-
Store a provided token as part of the location querystring. Because this function issues a location redirect, it should not return.
Vuex Action => Mutates state propertynone
Parameters:
Name Type Description nsContext
StoreContext token
string Token to include in the querystring. -
action redeemCode(nsContext)
-
Exchange a GitHub login code for a token that will allow API operations to be authorised by the given user. Because this function issues a location redirect it should not return.
Vuex Action => Mutates state propertynone
Parameters:
Name Type Description nsContext
StoreContext -
action registerBuildCheck(nsContext, payload) → {void|number}
-
Register a new build status check to take place in the future. If another build status check is scheduled for after the current time, don't add a new check.
Vuex Action => Mutates state propertybuildStatusChecks
Parameters:
Name Type Description nsContext
StoreContext payload
Object Properties
Name Type Attributes Default Description delay
number <optional>
180000 The delay before the build status check is executed. Defaults to 3 minutes. Returns:
void | number - The reference for the timeout.