Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Applications
Systems Frontend
Commits
78cbeaca
Commit
78cbeaca
authored
Oct 31, 2019
by
Anton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor metadata store module
parent
461ad869
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
src/store/modules/metadata.js
src/store/modules/metadata.js
+8
-7
No files found.
src/store/modules/metadata.js
View file @
78cbeaca
...
...
@@ -45,9 +45,9 @@ const metadata = {
}
}
if
(
payload
.
id
)
{
metadata
=
await
this
.
fetchTitle
(
metadata
,
payload
)
metadata
=
await
context
.
dispatch
(
'
fetchTitle
'
,
[
metadata
,
payload
]
)
}
console
.
debug
(
'
metadata
'
,
metadata
)
console
.
debug
(
'
metadata
/get
'
,
metadata
)
return
metadata
},
async
getLocal
(
context
,
payload
)
{
...
...
@@ -57,11 +57,12 @@ const metadata = {
if
(
typeof
payload
===
'
string
'
)
{
payload
=
await
context
.
dispatch
(
'
annotations/get
'
,
payload
,
{
root
:
true
})
}
let
metadata
metadata
=
context
.
state
.
cache
[
payload
.
body
.
source
.
id
]
||
{}
return
this
.
fetchTitle
(
context
,
metadata
,
payload
)
let
metadata
=
context
.
state
.
cache
[
payload
.
body
.
source
.
id
]
||
{}
metadata
=
await
context
.
dispatch
(
'
fetchTitle
'
,
[
metadata
,
payload
])
console
.
debug
(
'
metadata/getLocal
'
,
metadata
)
return
metadata
},
async
fetchTitle
(
context
,
metadata
,
payload
)
{
async
fetchTitle
(
context
,
[
metadata
,
payload
]
)
{
const
titleQuery
=
{
'
target.id
'
:
typeof
payload
===
'
string
'
?
`
${
BASE_URI
}
/annotations/
${
payload
}
`
:
payload
.
id
,
'
body.purpose
'
:
'
describing
'
,
...
...
@@ -73,7 +74,7 @@ const metadata = {
if
(
metadata
.
title
)
metadata
.
originalTitle
=
metadata
.
title
metadata
.
title
=
titleResult
.
items
[
0
].
body
.
value
}
console
.
debug
(
'
metadata
'
,
metadata
)
console
.
debug
(
'
metadata
/fetchTitle
'
,
metadata
)
return
metadata
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment