本文整理匯總了TypeScript中fluxx.LocalStore函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript LocalStore函數的具體用法?TypeScript LocalStore怎麽用?TypeScript LocalStore使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了LocalStore函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: LocalStore
export const loginStore = () => LocalStore(initialState, on => {
on(actions.updateEmail, (state, value) => {
return Object.assign({}, state, {
email: updateFieldValidation(state.email, value, validateEmail(value))
})
})
on(actions.updatePassword, (state, value) => {
return Object.assign({}, state, {
password: updateFieldValidation(state.password, value, validatePassword(value))
})
})
on(actions.updateErrors, (state, value) => {
return Object.assign({}, state, {errors: value})
})
on(actions.closeErrors, (state) => {
return Object.assign({}, state, {errors: null})
})
on(actions.success, (state) => {
return Object.assign({}, state, {step: "success"})
})
})
示例2: LocalStore
export const resetPasswordStore = () => LocalStore(initialState, on => {
on(actions.updatePassword, (state, value) => {
return Object.assign({}, state, {
password: updateFieldValidation(state.password, value, validatePassword(value)),
password2: updateUnchangedFieldValidation(state.password2, state.password2.value, validatePassword2(value, state.password2.value))
})
})
on(actions.updatePassword2, (state, value) => {
return Object.assign({}, state, {
password2: updateFieldValidation(state.password2, value, validatePassword2(state.password.value, value))
})
})
on(actions.updateErrors, (state, value) => {
return Object.assign({}, state, {errors: value})
})
on(actions.closeErrors, (state) => {
return Object.assign({}, state, {errors: null})
})
on(actions.success, (state) => {
return Object.assign({}, state, {step: "success"})
})
})
示例3: LocalStore
export const showListStore = () => LocalStore(initialState, on => {
on(actions.updateList, (state, shows) => {
return copy(state, {
nextShows: shows.filter(_ => _.plays && _.plays.length),
previousShows: shows.filter(_ => !(_.plays && _.plays.length))
})
})
})
示例4: LocalStore
export const playPageStore = () => LocalStore(initialState, on => {
on(actions.initialize, (state, {company, show, play, playsFromShow}) => {
return copy(state, {
company, show, play,
otherPlays: arrays.sort(playsFromShow.filter(p => p.id !== play.id), (p1, p2) => p1.date.getTime() - p2.date.getTime())
})
})
})
示例5: LocalStore
export const companyListStore = () => LocalStore(initialState, on => {
on(actions.updateList, (state, companies) => {
return copy(state, {
vepCompanies: arrays.sort(companies.filter(_ => _.isVep), compareCompanies),
notVepCompanies: arrays.sort(companies.filter(_ => !_.isVep), compareCompanies)
})
})
})
示例6: LocalStore
export const adhesionListStore = () => LocalStore(initialState, on => {
on(actions.initialize, (state, {period, adhesions}) => {
return copy(state, {
period: period,
acceptedAdhesions: adhesions.filter(_ => _.accepted),
notAcceptedAdhesions: adhesions.filter(_ => !_.accepted)
})
})
})
示例7: LocalStore
export const navigationStore = () => LocalStore(initialState, on => {
on(actions.initialize, (state, {shows, plays, pages}) => {
return copy(state, {shows, plays, pages})
})
on(actions.updateSession, (state, session) => {
return copy(state, {session})
})
})
示例8: LocalStore
export const requestAdhesionFormStore = () => LocalStore(initialState, on => {
on(actions.initialize, (state, {acceptedPeriods}) => {
return copy(state, {step: "form", acceptedPeriods})
})
on(actions.updatePeriod, (state, value) => {
return copy(state, {
period: updateFieldValidation(state.period, value, Valid(value))
})
})
on(actions.addMember, (state) => {
const newMembers = arrays.append(state.members.value, defaultMember)
return copy(state, {
members: updateFieldValidation(state.members, newMembers, validateMembers(newMembers))
})
})
on(actions.removeMember, (state, index) => {
const newMembers = arrays.remove(state.members.value, index)
return copy(state, {
members: updateFieldValidation(state.members, newMembers, validateMembers(newMembers))
})
})
on(actions.updateMemberFirstName, (state, {index, value}) =>
updateMember(state, index, member => copy(member, {
firstName: updateFieldValidation(member.firstName, value, validateNonBlank(value))
}))
)
on(actions.updateMemberLastName, (state, {index, value}) =>
updateMember(state, index, member => copy(member, {
lastName: updateFieldValidation(member.lastName, value, validateNonBlank(value))
}))
)
on(actions.updateMemberBirthday, (state, {index, value}) =>
updateMember(state, index, member => copy(member, {
birthday: updateFieldValidation(member.birthday, value, validatePassed(value))
}))
)
on(actions.updateMemberActivity, (state, {index, value}) =>
updateMember(state, index, member => copy(member, {
activity: updateFieldValidation(member.activity, value, Valid(value))
}))
)
on(actions.closeErrors, (state) => {
return copy(state, {errors: null})
})
on(actions.success, (state) => {
return copy(state, {step: "success"})
})
})
示例9: LocalStore
export const periodAdhesionListStore = () => LocalStore(initialState, on => {
on(actions.updateList, (state, periodsAdhesion) => {
return copy(state, {
currentPeriodsAdhesion: periodsAdhesion.filter(_ => isCurrent(_.period)),
futurePeriodsAdhesion: periodsAdhesion.filter(_ => isFuture(_.period)),
passedPeriodsAdhesion: periodsAdhesion.filter(_ => isPassed(_.period))
})
})
})
示例10: LocalStore
export const profilePageStore = () => LocalStore(initialState, on => {
on(actions.initialize, (state, {profile, adhesions}) => {
return copy(state, {
profile: profile,
acceptedAdhesions: adhesions.filter(_ => _.accepted),
notAcceptedAdhesions: adhesions.filter(_ => !_.accepted)
})
})
})