Merge branch 'dev' of github.com:Discours/discoursio-webapp into dev
This commit is contained in:
commit
a541e34090
|
@ -216,7 +216,9 @@ type InitialState = {
|
||||||
topRatedMonthArticles?: Shout[]
|
topRatedMonthArticles?: Shout[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useArticlesStore = ({ sortedArticles }: InitialState = {}) => {
|
export const useArticlesStore = (initialState: InitialState = {}) => {
|
||||||
|
const sortedArticles = [...(initialState.sortedArticles || [])]
|
||||||
|
|
||||||
addArticles(sortedArticles)
|
addArticles(sortedArticles)
|
||||||
|
|
||||||
if (sortedArticles) {
|
if (sortedArticles) {
|
||||||
|
|
|
@ -96,8 +96,9 @@ type InitialState = {
|
||||||
authors?: Author[]
|
authors?: Author[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useAuthorsStore = ({ authors }: InitialState = {}) => {
|
export const useAuthorsStore = (initialState: InitialState = {}) => {
|
||||||
addAuthors(authors || [])
|
const authors = [...(initialState.authors || [])]
|
||||||
|
addAuthors(authors)
|
||||||
|
|
||||||
const getAuthorEntities = useStore(authorEntitiesStore)
|
const getAuthorEntities = useStore(authorEntitiesStore)
|
||||||
const getSortedAuthors = useStore(sortedAuthorsStore)
|
const getSortedAuthors = useStore(sortedAuthorsStore)
|
||||||
|
|
|
@ -116,9 +116,12 @@ type InitialState = {
|
||||||
sortBy?: TopicsSortBy
|
sortBy?: TopicsSortBy
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useTopicsStore = ({ topics, randomTopics, sortBy }: InitialState = {}) => {
|
export const useTopicsStore = (initialState: InitialState = {}) => {
|
||||||
if (sortBy) {
|
const topics = [...(initialState.topics || [])]
|
||||||
sortAllByStore.set(sortBy)
|
const randomTopics = [...(initialState.randomTopics || [])]
|
||||||
|
|
||||||
|
if (initialState.sortBy) {
|
||||||
|
sortAllByStore.set(initialState.sortBy)
|
||||||
}
|
}
|
||||||
|
|
||||||
addTopics(topics, randomTopics)
|
addTopics(topics, randomTopics)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user