Fix clean install
This commit is contained in:
parent
5cc34a7ca1
commit
1ec9f604de
@ -250,12 +250,12 @@ export class CRUDReducer<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reduce = (
|
reduce = (
|
||||||
state: CRUDState<T> | undefined,
|
_state: CRUDState<T> | undefined,
|
||||||
action: CRUDAction<T, ActionType>,
|
action: CRUDAction<T, ActionType>,
|
||||||
): CRUDState<T> => {
|
): CRUDState<T> => {
|
||||||
const {defaultState} = this
|
const {defaultState} = this
|
||||||
state = state || defaultState
|
const state = _state || defaultState
|
||||||
|
|
||||||
if (action.type !== this.actionName) {
|
if (action.type !== this.actionName) {
|
||||||
return state
|
return state
|
||||||
|
|||||||
@ -12,12 +12,14 @@ export interface APIDef {
|
|||||||
'post': {
|
'post': {
|
||||||
body: NewUser & { captcha: string }
|
body: NewUser & { captcha: string }
|
||||||
response: UserProfile
|
response: UserProfile
|
||||||
|
params: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'/auth/login': {
|
'/auth/login': {
|
||||||
'post': {
|
'post': {
|
||||||
body: Credentials
|
body: Credentials
|
||||||
response: UserProfile
|
response: UserProfile
|
||||||
|
params: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'/auth/logout': {
|
'/auth/logout': {
|
||||||
@ -29,6 +31,7 @@ export interface APIDef {
|
|||||||
oldPassword: string
|
oldPassword: string
|
||||||
newPassword: string
|
newPassword: string
|
||||||
}
|
}
|
||||||
|
params: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -237,7 +237,7 @@ describe('createActions', () => {
|
|||||||
method: 'missingMethod',
|
method: 'missingMethod',
|
||||||
status: 'resolved',
|
status: 'resolved',
|
||||||
payload: null,
|
payload: null,
|
||||||
})
|
} as any)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -4,5 +4,9 @@
|
|||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
"rootDir": "src"
|
"rootDir": "src"
|
||||||
},
|
},
|
||||||
"references": []
|
"references": [
|
||||||
}
|
{
|
||||||
|
"path": "../react-test"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|||||||
@ -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'
|
import { PromiseMiddleware, ReduxLogger } from '../middleware'
|
||||||
|
|
||||||
export interface CreateStoreParams<State, A extends Action> {
|
export interface CreateStoreParams<State, A extends Action> {
|
||||||
@ -35,7 +35,7 @@ export function createStore<State, A extends Action>(
|
|||||||
params.reducer,
|
params.reducer,
|
||||||
// stupid warning about how Partial<State> | undefined cannot be used as
|
// stupid warning about how Partial<State> | undefined cannot be used as
|
||||||
// DeepPartial<State> | undefined
|
// DeepPartial<State> | undefined
|
||||||
params.state as DeepPartial<State> | undefined,
|
params.state as PreloadedState<State> | undefined,
|
||||||
applyMiddleware(...middleware),
|
applyMiddleware(...middleware),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
9
packages/scripts/preinstall.js
Normal file
9
packages/scripts/preinstall.js
Normal 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', '')
|
||||||
|
}
|
||||||
@ -18,7 +18,7 @@ export class CSRFMiddleware implements Middleware {
|
|||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: true,
|
sameSite: true,
|
||||||
secure: params.baseUrl.protocol === 'https',
|
secure: params.baseUrl.protocol === 'https',
|
||||||
path: params.baseUrl.path,
|
path: params.baseUrl.path !== null ? params.baseUrl.path : undefined,
|
||||||
key: params.cookieName,
|
key: params.cookieName,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export class SessionMiddleware implements Middleware {
|
|||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: true,
|
sameSite: true,
|
||||||
secure: params.baseUrl.protocol === 'https',
|
secure: params.baseUrl.protocol === 'https',
|
||||||
path: params.baseUrl.path,
|
path: params.baseUrl.path !== null ? params.baseUrl.path : undefined,
|
||||||
},
|
},
|
||||||
store: new SessionStore({
|
store: new SessionStore({
|
||||||
cleanupDelay: 60 * 1000,
|
cleanupDelay: 60 * 1000,
|
||||||
|
|||||||
@ -19,14 +19,12 @@ export class AsyncRouter<R extends Routes> {
|
|||||||
TypedHandler<R, P, M>,
|
TypedHandler<R, P, M>,
|
||||||
]
|
]
|
||||||
) {
|
) {
|
||||||
const addRoute = this.router[method].bind(this.router as any)
|
|
||||||
|
|
||||||
if (handlers.length === 2) {
|
if (handlers.length === 2) {
|
||||||
const middleware = handlers[0]
|
const middleware = handlers[0]
|
||||||
const handler = handlers[1]
|
const handler = handlers[1]
|
||||||
addRoute(path, ...middleware, this.wrapHandler(handler))
|
this.router[method](path, ...middleware, this.wrapHandler(handler))
|
||||||
} else {
|
} else {
|
||||||
addRoute(path, this.wrapHandler(handlers[0]))
|
this.router[method](path, this.wrapHandler(handlers[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user