Skip to content
Snippets Groups Projects
Commit 2a46a368 authored by Tarje.Lavik's avatar Tarje.Lavik
Browse files

Fix error when parsing label langs

parent 418bfae3
No related branches found
No related tags found
No related merge requests found
import {nanoid} from 'nanoid'
import { nanoid } from 'nanoid'
import { mapLanguage } from '../../shared/mapLanguage'
import { mapTypes } from '../../shared/mapTypes'
const getLabel = (item) => {
const { caption, properties } = item
const { ['*']: k, ...restCaption } = caption
const { ['*']: k2, ...restName } = properties['entity.name'][0].value
console.log(restCaption, restName)
return {
label: {
_type: "LocaleString",
...item.caption ?? '',
...item.properties['entity.name'][0]?.value ?? ''
...restCaption ?? '',
...restName ?? '',
}
}
}
......@@ -85,7 +91,7 @@ export const getDocument = (item) => {
...getDescription(desc)
]
}),
...(item.entityType != 'Concept' && {hasType: mapTypes([item.entityType])}),
...(item.entityType != 'Concept' && { hasType: mapTypes([item.entityType]) }),
// Which dataset does this belongs?
...(item.properties['entity.dataset'] && {
inDataset: {
......
import {nanoid} from 'nanoid'
import { nanoid } from 'nanoid'
import { getDocument } from './getDocument'
import sanityClient from 'part:@sanity/base/client'
const client = sanityClient.withConfig({apiVersion: '2021-03-25'})
const client = sanityClient.withConfig({ apiVersion: '2021-03-25' })
const createDoc = async (doc, importTo) => {
if(!doc) return {success: false}
if (!doc) return { success: false }
let importDoc = doc
if(importTo) {
importDoc._type = importTo
if (importTo) {
importDoc._type = importTo
}
const transaction = client.transaction()
......@@ -29,7 +29,7 @@ const createDoc = async (doc, importTo) => {
export const chooseItem = async (item, importTo) => {
const doc = getDocument(item)
console.log(importTo)
// console.log(importTo)
/* TODO
Important to include iiif manifest in asset metadata as the asset could be reused else where in the dataset */
/* const assetMeta = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment