Revize fb120216
Přidáno uživatelem Fantič před více než 1 rok
src/stores/actions/itemThunks.ts | ||
---|---|---|
1 | 1 |
import { createAsyncThunk } from "@reduxjs/toolkit" |
2 | 2 |
import { getItemRequest } from "../../api/itemservice" |
3 | 3 |
import { getItemNotesRequest } from "../../api/notesservice" |
4 |
import { Certainty, Concordance, Item } from "../../types/item"; |
|
4 |
import { Certainty, Concordance, Item, ItemObject } from "../../types/item";
|
|
5 | 5 |
|
6 | 6 |
|
7 | 7 |
export const getItem = createAsyncThunk( |
... | ... | |
16 | 16 |
if (response.status === 200 && response.data.object.length > 1) { |
17 | 17 |
// TODO IMAGES to array :-) |
18 | 18 |
const authorName = response.data?.object[1]?.name?.[0]?.getty_data?.display_name ?? undefined; |
19 |
const images : {imageUrl: string, title: string, relationship_type: string, cert: Certainty}[] = []
|
|
19 |
const images : ItemObject[] = []
|
|
20 | 20 |
for(let i = 1; i < response.data.object.length; i++){ |
21 |
images.push({imageUrl: response.data.object[i]?.images?.[0]?.file ?? "", title: response.data.object[i]?.images?.[0]?.text ?? "", relationship_type: response.data.object[i].relationship_type ?? "", cert: response.data.object[i].cert ?? Certainty.Unknown }) |
|
21 |
images.push({ |
|
22 |
imageUrl: response.data.object[i]?.images?.[0]?.file ?? undefined, |
|
23 |
title: response.data.object[i]?.images?.[0]?.text ?? undefined, |
|
24 |
relationship_type: response.data.object[i].relationship_type ?? undefined, |
|
25 |
cert: response.data.object[i].cert ?? Certainty.Unknown , |
|
26 |
|
|
27 |
author: response.data?.object[i]?.name?.[0]?.getty_data?.display_name ?? undefined, |
|
28 |
description: response.data?.object[i]?.physical_description ?? undefined, |
|
29 |
institution: { |
|
30 |
name: response.data?.object[i]?.institution ?? undefined, |
|
31 |
inventoryNumber: response.data?.object[i]?.id_number ?? undefined, |
|
32 |
country: response.data?.object[i]?.country ?? undefined, |
|
33 |
city: response.data?.object[i]?.city ?? undefined |
|
34 |
}, |
|
35 |
provenance: response.data?.object[i]?.provenance ?? undefined, |
|
36 |
repository: response.data?.object[i]?.repository ?? undefined |
|
37 |
}) |
|
22 | 38 |
} |
23 | 39 |
|
24 | 40 |
const institution = { |
Také k dispozici: Unified diff
re #10895: ItemView: ItemObjects switching, display color