Revize fedb75d6
Přidáno uživatelem Fantič před téměř 2 roky(ů)
src/stores/reducers/itemSlice.ts | ||
---|---|---|
25 | 25 |
}, |
26 | 26 |
extraReducers: (builder) => { |
27 | 27 |
// getItem |
28 |
builder.addCase(getItem.fulfilled, (state, action) => {
|
|
28 |
builder.addCase(getItem.fulfilled, (state, action) => { |
|
29 | 29 |
|
30 |
state.item.id= action.payload.id; |
|
31 |
state.item.authorDisplayName= action.payload.authorDisplayName; |
|
32 |
state.item.workName= action.payload.workName; |
|
33 |
state.item.concordances= action.payload.concordances; |
|
34 |
state.item.searchSubjects= action.payload.searchSubjects; |
|
35 |
state.item.inventoryItem= action.payload.inventoryItem; |
|
36 |
state.item.fullView= action.payload.fullView; |
|
37 |
|
|
38 |
if (action.payload.fullView) { |
|
39 |
state.item.institution = action.payload.institution; |
|
40 |
state.item.authorName = action.payload.authorName; |
|
41 |
state.item.imageUrl = action.payload.imageUrl; |
|
42 |
state.item.title = action.payload.title; |
|
43 |
state.item.repository = action.payload.repository; |
|
44 |
state.item.provenance = action.payload.provenance; |
|
45 |
state.item.description = action.payload.description; |
|
46 |
} |
|
47 |
else{ |
|
48 |
state.item.institution = undefined; |
|
49 |
state.item.authorName = undefined; |
|
50 |
state.item.imageUrl = undefined; |
|
51 |
state.item.title = undefined; |
|
52 |
state.item.repository = undefined; |
|
53 |
state.item.provenance = undefined; |
|
54 |
state.item.description = undefined; |
|
55 |
} |
|
56 |
|
|
30 | 57 |
// set concordances from item, if selected concordance is 0 |
31 | 58 |
if (state.selectedConcordance === 0) { |
59 |
console.log("Tohle se vola!"); |
|
32 | 60 |
state.concordances = action.payload.concordances; |
33 | 61 |
} |
34 | 62 |
|
35 |
state.item = { |
|
36 |
id: action.payload.id, |
|
37 |
authorDisplayName: action.payload.authorDisplayName, |
|
38 |
workName: action.payload.workName, |
|
39 |
concordances: action.payload.concordances, |
|
40 |
searchSubjects: action.payload.searchSubjects, |
|
41 |
inventoryItem: action.payload.inventoryItem, |
|
42 |
fullView: action.payload.fullView, |
|
43 |
} as Item |
|
44 |
|
|
45 |
if(action.payload.fullView){ |
|
46 |
state.item = { |
|
47 |
...state.item, |
|
48 |
// additional |
|
49 |
institution: action.payload.institution, |
|
50 |
authorName: action.payload.authorName, |
|
51 |
imageUrl: action.payload.imageUrl, |
|
52 |
title: action.payload.title, |
|
53 |
repository: action.payload.repository, |
|
54 |
provenance: action.payload.provenance, |
|
55 |
description: action.payload.description |
|
56 |
} |
|
57 |
} |
|
58 | 63 |
}) |
59 | 64 |
builder.addCase(getItem.rejected, (state, action) => { |
60 | 65 |
state.lastError = action.error.message |
Také k dispozici: Unified diff
re #10454: ItemView: get itemViewState fix