Fix broken build
This commit is contained in:
parent
195d7226e8
commit
36338ccdbe
@ -1,36 +0,0 @@
|
||||
import { ICredentials } from '@rondo.dev/common'
|
||||
import { TStateSelector } from '@rondo.dev/redux'
|
||||
import { bindActionCreators } from 'redux'
|
||||
import { Connector } from '../redux/Connector'
|
||||
import { LoginActions } from './LoginActions'
|
||||
import { LoginForm } from './LoginForm'
|
||||
import { ILoginState } from './LoginReducer'
|
||||
import { withForm } from './withForm'
|
||||
|
||||
const defaultCredentials: ICredentials = {
|
||||
username: '',
|
||||
password: '',
|
||||
}
|
||||
|
||||
export class LoginConnector extends Connector<ILoginState> {
|
||||
|
||||
constructor(protected readonly loginActions: LoginActions) {
|
||||
super()
|
||||
}
|
||||
|
||||
connect<State>(getLocalState: TStateSelector<State, ILoginState>) {
|
||||
return this.wrap(
|
||||
getLocalState,
|
||||
state => ({
|
||||
error: state.error,
|
||||
user: state.user,
|
||||
redirectTo: state.redirectTo,
|
||||
}),
|
||||
dispatch => ({
|
||||
onSubmit: bindActionCreators(this.loginActions.logIn, dispatch),
|
||||
clearOnSuccess: true,
|
||||
}),
|
||||
withForm(LoginForm, defaultCredentials),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
import {Connector} from '../redux/Connector'
|
||||
import {INewUser} from '@rondo.dev/common'
|
||||
import {ILoginState} from './LoginReducer'
|
||||
import {TStateSelector} from '@rondo.dev/redux'
|
||||
import {LoginActions} from './LoginActions'
|
||||
import {RegisterForm} from './RegisterForm'
|
||||
import {bindActionCreators} from 'redux'
|
||||
import {withForm} from './withForm'
|
||||
|
||||
const defaultCredentials: INewUser = {
|
||||
username: '',
|
||||
password: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
}
|
||||
|
||||
export class RegisterConnector extends Connector<ILoginState> {
|
||||
|
||||
constructor(protected readonly loginActions: LoginActions) {
|
||||
super()
|
||||
}
|
||||
|
||||
connect<State>(getLocalState: TStateSelector<State, ILoginState>) {
|
||||
return this.wrap(
|
||||
getLocalState,
|
||||
state => ({
|
||||
error: state.error,
|
||||
user: state.user,
|
||||
redirectTo: state.redirectTo,
|
||||
}),
|
||||
dispatch => ({
|
||||
onSubmit: bindActionCreators(this.loginActions.register, dispatch),
|
||||
clearOnSuccess: true,
|
||||
}),
|
||||
withForm(RegisterForm, defaultCredentials),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,17 @@
|
||||
import { IAPIDef } from '@rondo.dev/common'
|
||||
import { HTTPClientMock } from '@rondo.dev/http-client'
|
||||
import { getError } from '@rondo.dev/test-utils'
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import T from 'react-dom/test-utils'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import { TestUtils } from '../test-utils'
|
||||
import * as Feature from './'
|
||||
import { IAPIDef } from '@rondo.dev/common';
|
||||
import { HTTPClientMock } from '@rondo.dev/http-client';
|
||||
import { getError } from '@rondo.dev/test-utils';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import T from 'react-dom/test-utils';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { TestUtils } from '../test-utils';
|
||||
import * as Feature from './';
|
||||
import { configureLogin } from './configureLogin';
|
||||
|
||||
const test = new TestUtils()
|
||||
|
||||
describe('LoginForm', () => {
|
||||
describe('configureLogin', () => {
|
||||
|
||||
const http = new HTTPClientMock<IAPIDef>()
|
||||
const loginActions = new Feature.LoginActions(http)
|
||||
@ -20,7 +21,7 @@ describe('LoginForm', () => {
|
||||
select: state => state.Login,
|
||||
})
|
||||
.withComponent(
|
||||
select => new Feature.LoginConnector(loginActions).connect(select),
|
||||
select => configureLogin(select, loginActions),
|
||||
)
|
||||
.withJSX((Component, props) =>
|
||||
<MemoryRouter><Component {...props} /></MemoryRouter>,
|
||||
32
packages/client/src/login/configureLogin.ts
Normal file
32
packages/client/src/login/configureLogin.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { ICredentials } from '@rondo.dev/common'
|
||||
import { TStateSelector, pack } from '@rondo.dev/redux'
|
||||
import { bindActionCreators } from 'redux'
|
||||
import { Connector } from '../redux/Connector'
|
||||
import { LoginActions } from './LoginActions'
|
||||
import { LoginForm } from './LoginForm'
|
||||
import { ILoginState } from './LoginReducer'
|
||||
import { withForm } from './withForm'
|
||||
|
||||
const defaultCredentials: ICredentials = {
|
||||
username: '',
|
||||
password: '',
|
||||
}
|
||||
|
||||
export function configureLogin<State>(
|
||||
getLocalState: TStateSelector<State, ILoginState>,
|
||||
loginActions: LoginActions,
|
||||
) {
|
||||
return pack(
|
||||
getLocalState,
|
||||
state => ({
|
||||
error: state.error,
|
||||
user: state.user,
|
||||
redirectTo: state.redirectTo,
|
||||
}),
|
||||
dispatch => ({
|
||||
onSubmit: bindActionCreators(loginActions.logIn, dispatch),
|
||||
clearOnSuccess: true,
|
||||
}),
|
||||
withForm(LoginForm, defaultCredentials),
|
||||
)
|
||||
}
|
||||
@ -1,16 +1,17 @@
|
||||
import { IAPIDef } from '@rondo.dev/common'
|
||||
import { HTTPClientMock } from '@rondo.dev/http-client'
|
||||
import { getError } from '@rondo.dev/test-utils'
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import T from 'react-dom/test-utils'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import { TestUtils } from '../test-utils'
|
||||
import * as Feature from './'
|
||||
import { IAPIDef } from '@rondo.dev/common';
|
||||
import { HTTPClientMock } from '@rondo.dev/http-client';
|
||||
import { getError } from '@rondo.dev/test-utils';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import T from 'react-dom/test-utils';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { TestUtils } from '../test-utils';
|
||||
import * as Feature from './';
|
||||
import { configureRegister } from './configureRegister';
|
||||
|
||||
const test = new TestUtils()
|
||||
|
||||
describe('RegisterForm', () => {
|
||||
describe('configureRegister', () => {
|
||||
|
||||
const http = new HTTPClientMock<IAPIDef>()
|
||||
const loginActions = new Feature.LoginActions(http)
|
||||
@ -20,7 +21,7 @@ describe('RegisterForm', () => {
|
||||
select: state => state.Login,
|
||||
})
|
||||
.withComponent(
|
||||
select => new Feature.RegisterConnector(loginActions).connect(select),
|
||||
select => configureRegister(select, loginActions),
|
||||
)
|
||||
.withJSX((Component, props) =>
|
||||
<MemoryRouter><Component {...props} /></MemoryRouter>,
|
||||
33
packages/client/src/login/configureRegister.ts
Normal file
33
packages/client/src/login/configureRegister.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { INewUser } from '@rondo.dev/common';
|
||||
import { pack, TStateSelector } from '@rondo.dev/redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { LoginActions } from './LoginActions';
|
||||
import { ILoginState } from './LoginReducer';
|
||||
import { RegisterForm } from './RegisterForm';
|
||||
import { withForm } from './withForm';
|
||||
|
||||
const defaultCredentials: INewUser = {
|
||||
username: '',
|
||||
password: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
}
|
||||
|
||||
export function configureRegister<State>(
|
||||
getLocalState: TStateSelector<State, ILoginState>,
|
||||
loginActions: LoginActions,
|
||||
) {
|
||||
return pack(
|
||||
getLocalState,
|
||||
state => ({
|
||||
error: state.error,
|
||||
user: state.user,
|
||||
redirectTo: state.redirectTo,
|
||||
}),
|
||||
dispatch => ({
|
||||
onSubmit: bindActionCreators(loginActions.register, dispatch),
|
||||
clearOnSuccess: true,
|
||||
}),
|
||||
withForm(RegisterForm, defaultCredentials),
|
||||
)
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
export * from './LoginActions'
|
||||
export * from './LoginConnector'
|
||||
export * from './LoginForm'
|
||||
export * from './LoginReducer'
|
||||
export * from './RegisterForm'
|
||||
export * from './RegisterConnector'
|
||||
export * from './configureLogin';
|
||||
export * from './configureRegister';
|
||||
export * from './LoginActions';
|
||||
export * from './LoginForm';
|
||||
export * from './LoginReducer';
|
||||
export * from './RegisterForm';
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
import { IAPIDef, IUserInTeam, ITeamService, TeamServiceMethods, UserServiceMethods, TeamActions, UserActions, IUserService, ITeamUsers, Team } from '@rondo.dev/common'
|
||||
import { HTTPClientMock } from '@rondo.dev/http-client'
|
||||
import { ITeamService, ITeamUsers, IUserService, Team, TeamActions, TeamServiceMethods, UserActions, UserServiceMethods } from '@rondo.dev/common'
|
||||
import { createActions } from '@rondo.dev/jsonrpc'
|
||||
import createClientMock from '@rondo.dev/jsonrpc/lib/createClientMock'
|
||||
import { getError } from '@rondo.dev/test-utils'
|
||||
import React from 'react'
|
||||
import T from 'react-dom/test-utils'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import { TestUtils } from '../test-utils'
|
||||
import * as Feature from './'
|
||||
import { createActions, createRemoteClient } from '@rondo.dev/jsonrpc'
|
||||
import createClientMock from '@rondo.dev/jsonrpc/lib/createClientMock'
|
||||
|
||||
const test = new TestUtils()
|
||||
|
||||
@ -41,7 +40,8 @@ describe('TeamConnector', () => {
|
||||
reducers: {Team: Feature.Team},
|
||||
select: state => state.Team,
|
||||
})
|
||||
.withComponent(select => Feature.configure(teamActions, userActions, select))
|
||||
.withComponent(select =>
|
||||
Feature.configureTeam(select, teamActions, userActions))
|
||||
.withJSX((Component, props) =>
|
||||
<MemoryRouter initialEntries={historyEntries}>
|
||||
<Component {...props} />
|
||||
@ -3,10 +3,10 @@ import { bindActionCreators, pack, TStateSelector } from '@rondo.dev/redux'
|
||||
import { TeamManager } from './TeamManager'
|
||||
import { ITeamState } from './TeamReducer'
|
||||
|
||||
export function configure<State>(
|
||||
export function configureTeam<State>(
|
||||
getLocalState: TStateSelector<State, ITeamState>,
|
||||
teamActions: TeamActions,
|
||||
userActions: UserActions,
|
||||
getLocalState: TStateSelector<State, ITeamState>,
|
||||
) {
|
||||
const Component = pack(
|
||||
getLocalState,
|
||||
@ -1,4 +1,4 @@
|
||||
export * from './TeamConnector'
|
||||
export * from './configureTeam'
|
||||
export * from './TeamList'
|
||||
export * from './TeamManager'
|
||||
export * from './TeamReducer'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user