2016-08-10 21:36:11 +02:00
|
|
|
/**
|
|
|
|
* This file defines authentication related models.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// NPM imports
|
2016-08-01 00:26:52 +02:00
|
|
|
import Immutable from "immutable";
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
|
|
|
|
/** Record to store token parameters */
|
2016-08-01 00:26:52 +02:00
|
|
|
export const tokenRecord = Immutable.Record({
|
2016-08-10 21:36:11 +02:00
|
|
|
token: null, /** Token string */
|
2016-08-10 23:50:23 +02:00
|
|
|
expires: null, /** Token expiration date */
|
2016-08-01 00:26:52 +02:00
|
|
|
});
|
|
|
|
|
2016-08-10 21:36:11 +02:00
|
|
|
|
|
|
|
/** Record to store the full auth state */
|
2016-08-01 00:26:52 +02:00
|
|
|
export const stateRecord = new Immutable.Record({
|
2016-08-10 21:36:11 +02:00
|
|
|
token: new tokenRecord(), /** Auth token */
|
|
|
|
username: null, /** Username */
|
|
|
|
endpoint: null, /** Ampache server base URL */
|
|
|
|
rememberMe: false, /** Whether to remember me or not */
|
|
|
|
isAuthenticated: false, /** Whether authentication is ok or not */
|
|
|
|
isAuthenticating: false, /** Whether authentication is in progress or not */
|
|
|
|
error: null, /** An error string */
|
|
|
|
info: null, /** An info string */
|
2016-08-10 23:50:23 +02:00
|
|
|
timerID: null, /** Timer ID for setInterval calls to revive API session */
|
2016-08-01 00:26:52 +02:00
|
|
|
});
|