@stackend/api
Version:
JS bindings to api.stackend.com
50 lines • 1.51 kB
TypeScript
import { LOGIN, LOGOUT, REQUEST_LOGIN_DATA, UPDATE_LOGIN_DATA } from './loginReducer';
import { User } from '../user';
import { Thunk, XcapJsonResult } from '../api';
import { PersistentData } from '../api/AccessToken';
export declare type LoginActions = {
type: typeof LOGIN;
} | {
type: typeof LOGOUT;
} | {
type: typeof REQUEST_LOGIN_DATA;
} | {
type: typeof UPDATE_LOGIN_DATA;
json: {
user: User | null;
[rest: string]: any;
};
};
export declare function reduxLogin(): LoginActions;
export declare function reduxLogout(): LoginActions;
/**
* Refresh the current user. Cached 1 minute.
* @param params { force?:boolean }
* @returns
*/
export declare function refreshLoginData(params?: {
force?: boolean;
}): Thunk<Promise<any>>;
export declare function receiveLoginData(json: {
user: User | null;
}): LoginActions;
export interface AuthenticateUsingCredentialsResult extends XcapJsonResult {
/**
* The current user
*/
user: User | null;
/**
* Additional communities the user was authenticated to
*/
authenticatedToCommunities: Array<string>;
}
/**
* Authenticate a user using its credentials.
* @param credentials optional credentials
* @param community optional community name
*/
export declare function authenticateUsingCredentials({ credentials, community }: {
credentials?: PersistentData;
community?: string;
}): Thunk<Promise<AuthenticateUsingCredentialsResult>>;
//# sourceMappingURL=loginAction.d.ts.map