Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Språksamlingane
beta.ordbok.uib.no
Commits
9b508950
Commit
9b508950
authored
3 years ago
by
Henrik Askjer
Browse files
Options
Downloads
Patches
Plain Diff
Organize endpoints and add stage parameter
parent
d93a1548
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.env
+1
-1
1 addition, 1 deletion
.env
.env.dev_server
+2
-1
2 additions, 1 deletion
.env.dev_server
.env.local
+2
-1
2 additions, 1 deletion
.env.local
.env.production
+2
-1
2 additions, 1 deletion
.env.production
src/components/DictionaryView.vue
+22
-15
22 additions, 15 deletions
src/components/DictionaryView.vue
with
29 additions
and
19 deletions
.env
+
1
−
1
View file @
9b508950
VUE_APP_
API_PREFIX=
VUE_APP_
SEARCH_ENDPOINT='https://oda.uib.no/opal/api/'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.env.dev_server
+
2
−
1
View file @
9b508950
NODE_ENV=production
VUE_APP_API_PREFIX=
VUE_APP_API_STAGE=dev
VUE_APP_ARTICLE_ENDPOINT='https://oda.uib.no/opal/dev/'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.env.local
+
2
−
1
View file @
9b508950
VUE_APP_API_PREFIX=https://dev.ordbok.uib.no
VUE_APP_API_STAGE=dev
VUE_APP_ARTICLE_ENDPOINT='https://oda.uib.no/opal/dev/'
VUE_APP_VERSION_LABEL=LOCAL
VUE_APP_RELEASE=test
This diff is collapsed.
Click to expand it.
.env.production
+
2
−
1
View file @
9b508950
NODE_ENV=production
VUE_APP_VERSION_LABEL=Beta
VUE_APP_API_PREFIX=
VUE_APP_API_STAGE=prod
VUE_APP_ARTICLE_ENDPOINT='https://oda.uib.no/opal/prod/'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/components/DictionaryView.vue
+
22
−
15
View file @
9b508950
...
...
@@ -75,26 +75,33 @@ import Autocomplete from './Autocomplete.vue'
import
{
setup
}
from
'
axios-cache-adapter
'
const
SEARCH_ENDPOINT
=
process
.
env
.
VUE_APP_SEARCH_ENDPOINT
const
ARTICLE_ENDPOINT
=
process
.
env
.
VUE_APP_ARTICLE_ENDPOINT
const
API_STAGE
=
process
.
env
.
VUE_APP_API_STAGE
console
.
log
(
SEARCH_ENDPOINT
)
console
.
log
(
ARTICLE_ENDPOINT
)
console
.
log
(
API_STAGE
)
const
dicts
=
{
'
nob
'
:
'
Nynorskorboka
'
,
'
bob
'
:
'
Bokmålsordboka
'
,
'
bob,nob
'
:
'
ordbøkene
'
}
const
oda_api
=
setup
({
baseURL
:
'
https://oda.uib.no/opal/api/
'
,
baseURL
:
SEARCH_ENDPOINT
,
params
:
{
stage
:
API_STAGE
},
cache
:
{
maxAge
:
15
*
60
*
1000
,
exclude
:
{
query
:
false
,
paths
:
[
"
articles
"
]
paths
:
[
"
articles
"
]
// Disable caching for articles
}
}
})
const
api_endpoint
=
process
.
env
.
VUE_APP_API_PREFIX
+
'
/api/dict
'
const
oda_dev
=
'
https://oda.uib.no/opal/dev
'
const
dicts
=
{
'
nob
'
:
'
Nynorskorboka
'
,
'
bob
'
:
'
Bokmålsordboka
'
,
'
bob,nob
'
:
'
ordbøkene
'
}
function
navigate_to_article
(
self
,
source
)
{
let
config
=
{
headers
:
{}}
...
...
@@ -102,7 +109,7 @@ function navigate_to_article(self, source) {
if ((self.$route.query.nocache || '').toLowerCase() == 'true') {
config.headers.cachebuster = Date.now()
}*/
axios
.
get
(
oda_dev
+
'
/
'
+
self
.
$route
.
params
.
lang
+
'
/article/
'
+
self
.
$route
.
params
.
id
+
"
.json
"
,
config
)
axios
.
get
(
ARTICLE_ENDPOINT
+
self
.
$route
.
params
.
lang
+
'
/article/
'
+
self
.
$route
.
params
.
id
+
"
.json
"
,
config
)
.
then
(
function
(
response
){
self
.
article
=
Object
.
assign
(
response
.
data
,
{
'
dictionary
'
:
self
.
$route
.
params
.
lang
,
results
:
self
.
search_results
})
self
.
search_results
=
[]
...
...
@@ -168,7 +175,7 @@ function navigate_to_query(self, word) {
// Get individual articles
Promise
.
all
(
unwrapped
.
map
((
article
)
=>
{
return
axios
.
get
(
`
${
oda_dev
}
/
${
article
.
dictionary
}
/article/
${
article
.
id
}
.json`
)
return
axios
.
get
(
`
${
ARTICLE_ENDPOINT
}
${
article
.
dictionary
}
/article/
${
article
.
id
}
.json`
)
}))
.
then
((
response
)
=>
{
...
...
@@ -231,7 +238,7 @@ export default {
return
(
this
.
waiting_for_articles
||
this
.
waiting_for_metadata
)
&&
this
.
$route
.
name
!=
'
root
'
},
api_pref
:
function
()
{
return
api_endpoint
+
'
/
'
+
this
.
lang
+
'
/article/
'
return
ARTICLE_ENDPOINT
+
this
.
lang
+
'
/article/
'
},
get_oda_api
:
function
()
{
return
oda_api
...
...
@@ -298,11 +305,11 @@ export default {
this
.
lang
=
'
bob,nob
'
Promise
.
all
([
axios
.
get
(
oda_dev
+
'
/
nob/concepts.json
'
).
then
(
function
(
response
){
axios
.
get
(
ARTICLE_ENDPOINT
+
'
nob/concepts.json
'
).
then
(
function
(
response
){
let
concepts
=
response
.
data
.
concepts
entities
.
bob
=
concepts
}),
axios
.
get
(
oda_dev
+
'
/
nob/concepts.json
'
).
then
(
function
(
response
){
axios
.
get
(
ARTICLE_ENDPOINT
+
'
nob/concepts.json
'
).
then
(
function
(
response
){
let
concepts
=
response
.
data
.
concepts
entities
.
nob
=
concepts
})
...
...
@@ -326,11 +333,11 @@ export default {
}
// words of the month
axios
.
get
(
oda_dev
+
'
/
bob/article/5607.json
'
).
then
(
function
(
response
){
axios
.
get
(
ARTICLE_ENDPOINT
+
'
bob/article/5607.json
'
).
then
(
function
(
response
){
self
.
monthly_bm
=
Object
.
assign
(
response
.
data
,
{
dictionary
:
'
bob
'
})
})
axios
.
get
(
oda_dev
+
'
/
nob/article/78569.json
'
).
then
(
function
(
response
){
axios
.
get
(
ARTICLE_ENDPOINT
+
'
nob/article/78569.json
'
).
then
(
function
(
response
){
self
.
monthly_nn
=
Object
.
assign
(
response
.
data
,
{
dictionary
:
'
nob
'
})
})
}).
catch
(
function
(
_
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment