Sign In and Register actions

This commit is contained in:
Andrew Revinsky (DART)
2016-03-12 02:53:37 +03:00
parent 5511d1318e
commit afa3cf0042
19 changed files with 360 additions and 101 deletions

View File

@@ -86,15 +86,16 @@ export function initialize({cookies, isServer, currentLocation, userAgent} = {})
return store.dispatch(reduxAuthConfigure([
{
default: {
apiUrl: '/',
emailSignInPath: 'login',
emailRegistrationPath: 'customers'
//apiUrl: '/',
emailSignInPath: '/login',
emailRegistrationPath: '/customers'
}
}
], {
cookies,
isServer,
currentLocation,
storage: 'localStorage',
tokenFormat: {
"access-token": "{{ access-token }}"
},

View File

@@ -25,6 +25,7 @@ import {applyConfig} from "../utils/clientSettings";
import {destroySession} from "../utils/sessionStorage";
import getRedirectInfo from "../utils/parseUrl";
import {pushState} from "redux-router";
import root from '../utils/root';
export const SET_ENDPOINT_KEYS = "SET_ENDPOINT_KEYS";
export const STORE_CURRENT_ENDPOINT_KEY = "STORE_CURRENT_ENDPOINT_KEY";
@@ -40,6 +41,7 @@ export function storeCurrentEndpointKey(currentEndpointKey) {
export function configure(endpoint={}, settings={}) {
return dispatch => {
// don't render anything for OAuth redirects
if (settings.currentLocation && settings.currentLocation.match(/blank=true/)) {
return Promise.resolve({blank: true});
@@ -53,7 +55,7 @@ export function configure(endpoint={}, settings={}) {
user,
headers;
let {authRedirectPath, authRedirectHeaders} = getRedirectInfo(window.location);
//let { authRedirectPath, authRedirectHeaders} = getRedirectInfo(root.location);
// TODO: FiX!
//if (authRedirectPath) {
@@ -64,18 +66,21 @@ export function configure(endpoint={}, settings={}) {
//if (authRedirectHeaders && authRedirectHeaders["access-token"]) {
if (currentHeaders && currentHeaders["access-token"]) {
settings.initialCredentials = {
...(settings.initialCredentials || {}),
...authRedirectHeaders,
...currentHeaders
};
//settings.initialCredentials = {
// ...(settings.initialCredentials || {}),
// ...authRedirectHeaders,
// ...currentHeaders
//};
} else {
destroySession();
}
// if tokens were invalidated by server, make sure to clear browser
// credentials
if (!settings.initialCredentials) {
destroySession();
}
//if (!settings.initialCredentials) {
// destroySession();
//}
promise = Promise.resolve(applyConfig({ dispatch, endpoint, settings }));

View File

@@ -2,19 +2,20 @@
* Created by andrew on 26/02/16.
*/
import {
getEmailSignInUrl,
setCurrentEndpointKey,
getCurrentEndpointKey
} from "../utils/sessionStorage";
import { entityReceived } from './entities';
import { storeCurrentEndpointKey } from "./configure";
import { parseResponse } from "../utils/handleFetchResponse";
import fetch from "../utils/fetch";
//import { parseResponse } from "../utils/handleFetchResponse";
//import fetch from "../utils/fetch";
import { apiSignIn } from '../utils/api';
import T from '../constants/ACTION_TYPES';
import root from '../utils/root';
//import root from '../utils/root';
export function emailSignInFormUpdate(key, value) {
return { type: T.AUTH.SIGN_IN_FORM_UPDATE, key, value };
@@ -47,14 +48,7 @@ export function emailSignIn(body) {
dispatch(emailSignInStart());
return fetch(getEmailSignInUrl(currentEndpointKey), {
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
method: "post",
body: root.JSON.stringify(body)
}).then(parseResponse)
return apiSignIn(body)
.then(function(data = {}) {
const { id, customerInfo } = data;
if (id && customerInfo) {
@@ -62,6 +56,7 @@ export function emailSignIn(body) {
...customerInfo,
uid: id
};
debugger;
dispatch(entityReceived(id, user));
return user;
}

View File

@@ -0,0 +1,40 @@
/**
* Created by andrew on 11/03/16.
*/
import {
getEmailSignInUrl,
setCurrentEndpointKey,
getCurrentEndpointKey
} from "../utils/sessionStorage";
import {destroySession} from "../utils/sessionStorage";
import { entityReceived } from './entities';
import { storeCurrentEndpointKey } from "./configure";
import { parseResponse } from "../utils/handleFetchResponse";
import fetch from "../utils/fetch";
import T from '../constants/ACTION_TYPES';
import root from '../utils/root';
export function signOutStart() {
return { type: T.AUTH.SIGN_OUT_START };
}
export function signOutComplete() {
return { type: T.AUTH.SIGN_OUT_COMPLETE };
}
export function signOut() {
return dispatch => {
dispatch(signOutStart());
destroySession();
dispatch(signOutComplete());
};
}

View File

@@ -0,0 +1,46 @@
/**
* Created by andrew on 11/03/16.
*/
import {
getEmailSignUpUrl
} from "../utils/sessionStorage";
import { entityReceived } from './entities';
import { storeCurrentEndpointKey } from "./configure";
//import { parseResponse } from "../utils/handleFetchResponse";
import { apiSignUp } from "../utils/api";
import { emailSignIn } from './signIn';
import T from '../constants/ACTION_TYPES';
export function emailSignUpFormUpdate(key, value) {
return { type: T.AUTH.SIGN_UP_FORM_UPDATE, key, value };
}
export function emailSignUpStart() {
return { type: T.AUTH.SIGN_UP_START };
}
export function emailSignUpComplete(user) {
return { type: T.AUTH.SIGN_UP_COMPLETE, user };
}
export function emailSignUpError(errors) {
return { type: T.AUTH.SIGN_UP_ERROR, errors };
}
export function emailSignUp(body) {
return dispatch => {
dispatch(emailSignUpStart());
return apiSignUp(body)
.then(({data}) => {
dispatch(emailSignUpComplete(data));
const { email } = body;
return dispatch(emailSignIn({ email }));
})
.catch(({errors}) => dispatch(emailSignUpError(errors)));
};
}

View File

@@ -0,0 +1,66 @@
/**
* Created by andrew on 11/03/16.
*/
import React from 'react';
import { connect } from 'react-redux';
import { LinkContainer } from "react-router-bootstrap";
import read from '../utils/readProp';
//import { PageHeader, OverlayTrigger, Tooltip, Grid, Col, Row, Nav, NavItem, ButtonGroup, Button, Table } from "react-bootstrap";
import * as BS from "react-bootstrap";
import { Link, IndexLink } from "react-router";
import { signOut } from '../actions/signOut';
export class HeaderLinks extends React.Component {
signOut(evt, key) {
debugger;
signOut();
}
render() {
let buttonSet = null;
const isSignedIn = read(this.props.auth, 'user.isSignedIn', false);
const { location } = this.props.router;
const isRegister = location.pathname == '/register';
const isLogin = location.pathname == '/signin';
const condition = isSignedIn ? 2 : (isRegister ? 1 : 0);
switch (condition) {
case 0:
buttonSet = (<LinkContainer to="/register">
<BS.NavItem>Register</BS.NavItem>
</LinkContainer>);
break;
case 1:
buttonSet = (<LinkContainer to="/signin">
<BS.NavItem>Log In</BS.NavItem>
</LinkContainer>);
break;
case 2:
buttonSet = (<BS.NavItem onClick={this.signOut.bind(this)} eventKey="2">Sign Out</BS.NavItem>);
break;
}
return (
<BS.Nav pullRight={true}>
{ buttonSet }
</BS.Nav>
);
}
}
export default connect(({
//dispatch,
router,
auth
}) => ({
//dispatch,
router,
auth
}))(HeaderLinks);

View File

@@ -4,9 +4,12 @@
import React, { PropTypes } from "react";
import { Grid, Col, Navbar, NavItem, Nav, NavbarBrand, Footer } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
import HeaderLinks from '../HeaderLinks';
//import { SignOutButton } from "redux-auth/bootstrap-theme";
const SignOutButton = () => (<div>SignOutButton!</div>);
//const SignOutButton = () => (<div>SignOutButton!</div>);
//if (!global.__SERVER__ && !global.__TEST__) {
@@ -33,9 +36,9 @@ class Container extends React.Component {
<NavItem eventKey={2}>Account</NavItem>
</LinkContainer>
</Nav>
<Nav pullRight={true}>
<SignOutButton></SignOutButton>
</Nav>
<div>
<HeaderLinks />
</div>
</Navbar>
<Grid className="content">

View File

@@ -15,6 +15,10 @@ export default defineActionTypes({
SIGN_IN_COMPLETE
SIGN_IN_ERROR
SIGN_IN_FORM_UPDATE
SIGN_UP_START
SIGN_UP_COMPLETE
SIGN_UP_ERROR
SIGN_UP_FORM_UPDATE
SIGN_OUT_START
SIGN_OUT_COMPLETE
`,

View File

@@ -11,6 +11,8 @@ import ButtonLoader from "./ButtonLoader";
import { Glyphicon } from "react-bootstrap";
import { connect } from "react-redux";
import read from '../../utils/readProp';
import { emailSignInFormUpdate, emailSignIn } from "../../actions/signIn";
/*
@@ -25,19 +27,6 @@ import { emailSignInFormUpdate, emailSignIn } from "../../actions/signIn";
{...this.props.inputProps.password} />
*/
function read(src, path = '', defaultVal = '') {
const [pathItem = null, ...rest] = path.split('.');
if (pathItem === null ) {
return src;
} else if (rest.length === 0) {
if (!src) { return defaultVal; }
return src[pathItem];
} else {
if (!src) { return defaultVal; }
return read(src[pathItem], rest.join('.'));
}
}
class EmailSignInForm extends React.Component {
static propTypes = {
@@ -64,17 +53,20 @@ class EmailSignInForm extends React.Component {
handleSubmit (event) {
event.preventDefault();
let formData = { ...this.props.auth.signIn.form };
this.props.dispatch(emailSignIn(formData, null));
this.props.dispatch(emailSignIn(formData));
}
render () {
try {
let disabled = (
const disabled = (
this.props.auth.user.isSignedIn ||
this.props.auth.signIn.loading
);
//const error = read(this.props.auth, 'signIn.errors.email', null);
//debugger;
return (
<form className='redux-auth email-sign-in-form clearfix'
onSubmit={this.handleSubmit.bind(this)}>
@@ -85,7 +77,7 @@ class EmailSignInForm extends React.Component {
name="email"
disabled={disabled}
value={read(this.props.auth, 'signIn.form.email', '')}
errors={read(this.props.auth, 'signIn.errors.email', null)}
errors={read(this.props.auth, 'signIn.errors.email', {})}
onChange={this.handleInput.bind(this, "email")}
{...this.props.inputProps.email} />

View File

@@ -9,11 +9,12 @@ import ButtonLoader from "./ButtonLoader";
import IndexPanel from "./../../components/partials/IndexPanel";
import { customerInfoMap } from '../../entities/formToPayloadMappers';
import read from '../../utils/readProp';
import { Glyphicon } from "react-bootstrap";
import { connect } from "react-redux";
const emailSignUpFormUpdate = () => {debugger; },
emailSignUp = () => {debugger; };
import {emailSignUpFormUpdate, emailSignUp} from '../../actions/signUp';
class EmailSignUpForm extends React.Component {
@@ -44,22 +45,25 @@ class EmailSignUpForm extends React.Component {
}
handleInput (key, val) {
this.props.dispatch(emailSignUpFormUpdate(this.getEndpoint(), key, val));
this.props.dispatch(emailSignUpFormUpdate(key, val));
}
handleSubmit (event) {
event.preventDefault();
let formData = this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form"]).toJS();
let formData = { ...this.props.auth.signUp.form };
console.log(customerInfoMap(formData));
this.props.dispatch(emailSignUp(customerInfoMap(formData), this.getEndpoint()));
this.props.dispatch(emailSignUp(customerInfoMap(formData)));
}
render () {
let disabled = (
this.props.auth.getIn(["user", "isSignedIn"]) ||
this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "loading"])
);
try {
const disabled = (
this.props.auth.user.isSignedIn ||
this.props.auth.signUp.loading
);
return (
<form className='redux-auth email-sign-up-form clearfix'
@@ -72,8 +76,8 @@ class EmailSignUpForm extends React.Component {
placeholder="First name"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "fname"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "fname"])}
value={read(this.props.auth, 'signUp.form.fname', '')}
errors={read(this.props.auth, 'signUp.errors.fname', {})}
onChange={this.handleInput.bind(this, "fname")}
{...this.props.inputProps.fname} />
@@ -82,8 +86,8 @@ class EmailSignUpForm extends React.Component {
placeholder="Last name"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "lname"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "lname"])}
value={read(this.props.auth, 'signUp.form.lname', '')}
errors={read(this.props.auth, 'signUp.errors.lname', {})}
onChange={this.handleInput.bind(this, "lname")}
{...this.props.inputProps.lname} />
@@ -92,8 +96,8 @@ class EmailSignUpForm extends React.Component {
placeholder="Email"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "email"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "email"])}
value={read(this.props.auth, 'signUp.form.email', '')}
errors={read(this.props.auth, 'signUp.errors.email', {})}
onChange={this.handleInput.bind(this, "email")}
{...this.props.inputProps.email} />
@@ -106,8 +110,8 @@ class EmailSignUpForm extends React.Component {
placeholder="SSN"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "ssn"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "ssn"])}
value={read(this.props.auth, 'signUp.form.ssn', '')}
errors={read(this.props.auth, 'signUp.errors.ssn', {})}
onChange={this.handleInput.bind(this, "ssn")}
{...this.props.inputProps.ssn} />
@@ -116,8 +120,8 @@ class EmailSignUpForm extends React.Component {
placeholder="Phone"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "phone"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "phone"])}
value={read(this.props.auth, 'signUp.form.phone', '')}
errors={read(this.props.auth, 'signUp.errors.phone', {})}
onChange={this.handleInput.bind(this, "phone")}
{...this.props.inputProps.phone} />
@@ -126,8 +130,8 @@ class EmailSignUpForm extends React.Component {
placeholder="Address 1"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "address1"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "address1"])}
value={read(this.props.auth, 'signUp.form.address1', '')}
errors={read(this.props.auth, 'signUp.errors.address1', {})}
onChange={this.handleInput.bind(this, "address1")}
{...this.props.inputProps.address1} />
@@ -136,8 +140,8 @@ class EmailSignUpForm extends React.Component {
placeholder="Address 2"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "address2"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "address2"])}
value={read(this.props.auth, 'signUp.form.address2', '')}
errors={read(this.props.auth, 'signUp.errors.address2', {})}
onChange={this.handleInput.bind(this, "address2")}
{...this.props.inputProps.address2} />
@@ -146,8 +150,8 @@ class EmailSignUpForm extends React.Component {
placeholder="City"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "city"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "city"])}
value={read(this.props.auth, 'signUp.form.city', '')}
errors={read(this.props.auth, 'signUp.errors.city', {})}
onChange={this.handleInput.bind(this, "city")}
{...this.props.inputProps.city} />
@@ -156,8 +160,8 @@ class EmailSignUpForm extends React.Component {
placeholder="State"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "state"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "state"])}
value={read(this.props.auth, 'signUp.form.state', '')}
errors={read(this.props.auth, 'signUp.errors.state', {})}
onChange={this.handleInput.bind(this, "state")}
{...this.props.inputProps.state} />
@@ -166,8 +170,8 @@ class EmailSignUpForm extends React.Component {
placeholder="ZIP"
className="email-sign-up-email"
disabled={disabled}
value={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "form", "zip"])}
errors={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "errors", "zip"])}
value={read(this.props.auth, 'signUp.form.zip', '')}
errors={read(this.props.auth, 'signUp.errors.zip', {})}
onChange={this.handleInput.bind(this, "zip")}
{...this.props.inputProps.zip} />
@@ -175,7 +179,7 @@ class EmailSignUpForm extends React.Component {
<ButtonLoader loading={this.props.auth.getIn(["emailSignUp", this.getEndpoint(), "loading"])}
<ButtonLoader loading={read(this.props.auth, 'signUp.loading', false)}
type="submit"
className="email-sign-up-submit pull-right"
icon={<Glyphicon glyph="send" />}
@@ -186,6 +190,10 @@ class EmailSignUpForm extends React.Component {
</ButtonLoader>
</form>
);
} catch (ex){
console.error('Render exception: ', ex);
return [' ERROR '];
}
}
}

View File

@@ -53,7 +53,7 @@ class AuthInput extends React.Component {
return (
<div>
<Input {...this.props}
bsStyle={(this.props.errors.size) ? "error" : null}
bsStyle={(this.props.errors.length) ? "error" : null}
onChange={this.handleInput.bind(this)} />
{this.renderErrorList()}
</div>

View File

@@ -6,12 +6,14 @@ import { combineReducers } from 'redux';
import { configReducer } from './configure';
import { authReducer } from './authenticate';
import { signInReducer } from './signin';
import { signUpReducer } from './signup';
import { signOutReducer } from './signout';
import { userReducer } from './user';
const authStateReducer = combineReducers({
configure: configReducer,
signIn: signInReducer,
signUp: signUpReducer,
signOut: signOutReducer,
authentication: authReducer,
user: userReducer

View File

@@ -0,0 +1,43 @@
/**
* Created by andrew on 25/02/16.
*/
import T from '../../constants/ACTION_TYPES';
const signUpInitialState = {
loading: false,
errors: null,
form: {}
};
export const signUpReducer = (state = { ...signUpInitialState, form: {...signUpInitialState.form }}, action) => {
switch(action.type) {
case T.AUTH.SIGN_UP_START:
return {
...state,
loading: true
};
case T.AUTH.SIGN_UP_COMPLETE:
return {
...signUpInitialState,
form: { ...signUpInitialState.form }
};
case T.AUTH.SIGN_UP_ERROR:
const { errors } = action;
return {
...state,
loading: false,
errors
};
case T.AUTH.SIGN_UP_FORM_UPDATE:
const { key, value } = action;
return {
...state,
form: {
...state.form,
[key]: value
}
};
default: return state;
}
};

View File

@@ -0,0 +1,34 @@
/**
* Created by andrew on 12/03/16.
*/
import fetch from './fetch';
import {
getEmailSignInUrl,
getEmailSignUpUrl
} from "./sessionStorage";
import root from './root';
import { parseResponse } from "./handleFetchResponse";
export function apiSignIn(body) {
return fetch(getEmailSignInUrl(), {
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
method: "post",
body: root.JSON.stringify(body)
}).then(parseResponse);
}
export function apiSignUp(body) {
return fetch(getEmailSignUpUrl(), {
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
method: "post",
body: root.JSON.stringify(body)
}).then(parseResponse);
}

View File

@@ -3,13 +3,11 @@
*/
import originalFetch from "isomorphic-fetch";
import * as C from "./constants";
//import extend from "extend";
import {
getApiUrl,
retrieveData,
persistData,
getTokenFormat,
getSessionEndpointKey,
isApiRequest
} from "./sessionStorage";

View File

@@ -126,7 +126,7 @@ export default function getRedirectInfo(currentLocation) {
var authRedirectPath = getLocationWithoutParams(currentLocation, authKeys);
if (authRedirectPath !== currentLocation) {
return {authRedirectHeaders, authRedirectPath};
return { authRedirectHeaders, authRedirectPath };
} else {
return {};
}

View File

@@ -0,0 +1,16 @@
/**
* Created by andrew on 11/03/16.
*/
export default function read(src, path = '', defaultVal = null) {
const [pathItem = null, ...rest] = path.split('.');
if (pathItem === null ) {
return src;
} else if (rest.length === 0) {
if (!src) { return defaultVal; }
return src[pathItem];
}
if (!src) { return defaultVal; }
return read(src[pathItem], rest.join('.'), defaultVal);
}

View File

@@ -1,4 +1,6 @@
/**
* Created by andrew on 27/02/16.
*/
// even though this code shouldn't be used server-side, node will throw
// errors if "window" is used
export default Function("return this")() || (42, eval)("this");

View File

@@ -3,13 +3,11 @@
*/
import Cookies from "js-cookie";
import * as C from "./constants";
import root from './root';
//import "babel-polyfill";
// even though this code shouldn't be used server-side, node will throw
// errors if "window" is used
var root = Function("return this")() || (42, eval)("this");
// stateful variables that persist throughout session
root.authState = {
currentSettings: {},
@@ -33,14 +31,22 @@ export function getCurrentEndpoint () {
return root.authState.currentEndpoint;
}
/**
* @deprecated
* @param k
*/
export function setCurrentEndpointKey (k) {
persistData(C.SAVED_CONFIG_KEY, k || getDefaultEndpointKey());
}
export function getCurrentEndpointKey () {
return retrieveData(C.SAVED_CONFIG_KEY) || getDefaultEndpointKey();
return getDefaultEndpointKey();
}
/**
* @deprecated
* @param k
*/
export function setDefaultEndpointKey (k) {
persistData(C.DEFAULT_CONFIG_KEY, k);
}
@@ -81,7 +87,7 @@ export function destroySession () {
function unescapeQuotes (val) {
return val && val.replace(/("|')/g, "");
};
}
export function getInitialEndpointKey () {
return unescapeQuotes(
@@ -94,35 +100,33 @@ export function isApiRequest(url) {
return true;
}
// TODO: make this really work
export function getSessionEndpointKey (k) {
let key = k || getCurrentEndpointKey();
if (!key) {
throw "You must configure redux-auth before use.";
} else {
return key;
}
export function getSessionEndpointKey () {
return getCurrentEndpointKey();
}
export function getSessionEndpoint (k) {
return getCurrentEndpoint()[getSessionEndpointKey(k)];
return getCurrentEndpoint()[getSessionEndpointKey()];
}
// only should work for current session
export function getSignOutUrl (endpointKey) {
return `${getApiUrl(endpointKey)}${getSessionEndpoint(endpointKey).signOutPath}`
}
//// only should work for current session
//export function getSignOutUrl (endpointKey) {
// return `${getApiUrl(endpointKey)}${getSessionEndpoint(endpointKey).signOutPath}`
//}
export function getEmailSignInUrl (endpointKey) {
return `${getApiUrl(endpointKey)}${getSessionEndpoint(endpointKey).emailSignInPath}`
return `${getSessionEndpoint(endpointKey).emailSignInPath}`
}
export function getEmailSignUpUrl (endpointKey) {
return `${getApiUrl(endpointKey)}${getSessionEndpoint(endpointKey).emailRegistrationPath}?config_name=${endpointKey}`
return `${getSessionEndpoint(endpointKey).emailRegistrationPath}`
}
/**
* @deprecated
* @param key
* @returns {string|string}
*/
export function getApiUrl(key) {
let configKey = getSessionEndpointKey(key);
return root.authState.currentEndpoint[configKey].apiUrl;