Fix clean install

This commit is contained in:
Jerko Steiner 2020-01-09 15:15:29 +01:00
parent 5cc34a7ca1
commit 1ec9f604de
9 changed files with 28 additions and 14 deletions

View File

@ -250,12 +250,12 @@ export class CRUDReducer<
}
}
reduce = (
state: CRUDState<T> | undefined,
reduce = (
_state: CRUDState<T> | undefined,
action: CRUDAction<T, ActionType>,
): CRUDState<T> => {
const {defaultState} = this
state = state || defaultState
const state = _state || defaultState
if (action.type !== this.actionName) {
return state

View File

@ -12,12 +12,14 @@ export interface APIDef {
'post': {
body: NewUser & { captcha: string }
response: UserProfile
params: {}
}
}
'/auth/login': {
'post': {
body: Credentials
response: UserProfile
params: {}
}
}
'/auth/logout': {
@ -29,6 +31,7 @@ export interface APIDef {
oldPassword: string
newPassword: string
}
params: {}
}
}
}

View File

@ -237,7 +237,7 @@ describe('createActions', () => {
method: 'missingMethod',
status: 'resolved',
payload: null,
})
} as any)
})
})
})

View File

@ -4,5 +4,9 @@
"outDir": "lib",
"rootDir": "src"
},
"references": []
}
"references": [
{
"path": "../react-test"
}
]
}

View File

@ -1,4 +1,4 @@
import { Action, applyMiddleware, createStore as create, Middleware, Reducer, DeepPartial } from 'redux'
import { Action, applyMiddleware, createStore as create, Middleware, PreloadedState, Reducer } from 'redux'
import { PromiseMiddleware, ReduxLogger } from '../middleware'
export interface CreateStoreParams<State, A extends Action> {
@ -35,7 +35,7 @@ export function createStore<State, A extends Action>(
params.reducer,
// stupid warning about how Partial<State> | undefined cannot be used as
// DeepPartial<State> | undefined
params.state as DeepPartial<State> | undefined,
params.state as PreloadedState<State> | undefined,
applyMiddleware(...middleware),
)
}

View File

@ -0,0 +1,9 @@
const fs = require('fs')
if (!fs.existsSync('lib')) {
fs.mkdirSync('lib')
}
if (!fs.existsSync('lib/index.js')) {
fs.writeFileSync('lib/index.js', '')
}

View File

@ -18,7 +18,7 @@ export class CSRFMiddleware implements Middleware {
httpOnly: true,
sameSite: true,
secure: params.baseUrl.protocol === 'https',
path: params.baseUrl.path,
path: params.baseUrl.path !== null ? params.baseUrl.path : undefined,
key: params.cookieName,
},
})

View File

@ -31,7 +31,7 @@ export class SessionMiddleware implements Middleware {
httpOnly: true,
sameSite: true,
secure: params.baseUrl.protocol === 'https',
path: params.baseUrl.path,
path: params.baseUrl.path !== null ? params.baseUrl.path : undefined,
},
store: new SessionStore({
cleanupDelay: 60 * 1000,

View File

@ -19,14 +19,12 @@ export class AsyncRouter<R extends Routes> {
TypedHandler<R, P, M>,
]
) {
const addRoute = this.router[method].bind(this.router as any)
if (handlers.length === 2) {
const middleware = handlers[0]
const handler = handlers[1]
addRoute(path, ...middleware, this.wrapHandler(handler))
this.router[method](path, ...middleware, this.wrapHandler(handler))
} else {
addRoute(path, this.wrapHandler(handlers[0]))
this.router[method](path, this.wrapHandler(handlers[0]))
}
}