import AuthLoadingPresenter from 'PedalPatrol/src/components/presenters/authloading-presenter.js'
AuthLoadingPresenter
Extends:
Class for the auth loading presenter to check if the authentication state is valid. Uses the persist storage as the model.
Constructor Summary
Public Constructor | ||
public |
Creates an instance of AuthLoadingPresenter. |
Member Summary
Public Members | ||
public |
onDestroy: * Unsubscribe from models |
|
public |
Called when a response is received from the Home and the Alert models after it has received data. |
|
public |
Try to logout. |
Private Members | ||
private |
_callback: * |
|
private |
|
|
private |
|
|
private |
_numModels: * |
Method Summary
Public Methods | ||
public |
async checkAuthState(onSuccess: Function, onFailure: Function) Asynchronously check the authentication state of the user to see if they are logged in. |
|
public |
onRetrievalSuccess(userToken: string, onSuccess: Function, onFailure: Function) Check if the userToken is valid and if it is, then call the onSuccess callback, otherwise call the onFailure callback. |
|
public |
setCallback(callback: Function) Sets the callback to be called when data is received. |
Inherited Summary
From class BasePresenter | ||
public |
getData: * Gets the data from the model. |
|
public |
This method is called when the model's data has changed and the observers are being notified. |
|
public |
Sends an update to the model with new data. |
Public Constructors
public constructor() source
Creates an instance of AuthLoadingPresenter. Subscribes to models to await data
Public Members
public onUpdated(data: Object): * source
Called when a response is received from the Home and the Alert models after it has received data. Acquires a lock to make sure that both don't enter at the same time.
Override:
BasePresenter#onUpdatedpublic tryLogout(shouldLogout: Boolean, onSuccess: Function, onFailure: Function): * source
Try to logout. Function is called on every entry to the authloading view so only execute logout if logout is requested.
Private Members
private _callback: * source
private _numModels: * source
Public Methods
public async checkAuthState(onSuccess: Function, onFailure: Function) source
Asynchronously check the authentication state of the user to see if they are logged in.