Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
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
Margunn.Rauset
beta.ordbok.uib.no
Commits
f915d23a
Commit
f915d23a
authored
4 years ago
by
Ole Voldsæter
Browse files
Options
Downloads
Patches
Plain Diff
re meta#244 feilhåndtering i frontend ifm. ajax-kall
parent
a01bfd8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/App.vue
+48
-0
48 additions, 0 deletions
src/App.vue
with
48 additions
and
0 deletions
src/App.vue
+
48
−
0
View file @
f915d23a
...
...
@@ -114,6 +114,26 @@ function navigate_to_search(self, query) {
error
:
"
Vi fant ingen resultater for '
"
+
decodeURIComponent
(
query
)
+
"
'. (Søkeforlag kommer i en senere oppatering av Ordbøkene)
"
}
}
})
.
catch
(
function
(
error
){
if
(
error
.
response
&&
error
.
response
.
status
==
400
)
{
self
.
article
=
{
lemmas
:
[],
error
:
"
Søkeuttrykket inneholder feil
"
}
}
else
if
(
error
.
response
)
{
self
.
article
=
{
lemmas
:
[],
error
:
"
Noe gikk galt på serversiden
"
}
}
else
{
self
.
article
=
{
lemmas
:
[],
error
:
"
Nettverksproblemer, prøv igjen
"
}
}
})
.
then
(
function
(
_
){
self
.
waiting_for_articles
=
false
history
.
replaceState
({
article
:
self
.
article
,
search_results
:
self
.
search_results
,
lang
:
self
.
lang
},
''
)
})
...
...
@@ -123,6 +143,27 @@ function navigate_to_word(self, word) {
axios
.
get
(
self
.
api_pref
+
'
suggest?q=
'
+
word
)
.
then
(
function
(
response
){
self
.
search_results
=
response
.
data
.
filter
(
result
=>
result
.
match
.
length
==
word
.
length
)
if
(
!
self
.
search_results
.
length
)
{
self
.
article
=
{
lemmas
:
[],
error
:
"
Ordet '
"
+
decodeURIComponent
(
word
)
+
"
' finnes ikke i ordbøkene
"
}
}
})
.
catch
(
function
(
error
){
if
(
error
.
response
)
{
self
.
article
=
{
lemmas
:
[],
error
:
"
Noe gikk galt på serversiden
"
}
}
else
{
self
.
article
=
{
lemmas
:
[],
error
:
"
Nettverksproblemer, prøv igjen
"
}
}
})
.
then
(
function
(
_
){
self
.
waiting_for_articles
=
false
history
.
replaceState
({
article
:
self
.
article
,
search_results
:
self
.
search_results
,
lang
:
self
.
lang
},
''
)
})
...
...
@@ -223,6 +264,13 @@ export default {
axios
.
get
(
api_endpoint
+
'
/nob/article/78569
'
).
then
(
function
(
response
){
self
.
monthly_nn
=
Object
.
assign
(
response
.
data
,
{
dictionary
:
'
nob
'
})
})
}).
catch
(
function
(
_
){
self
.
article
=
{
lemmas
:
[],
error
:
"
Et nettverksproblem hindret lasting av siden. Prøv å laste siden på nytt
"
}
self
.
waiting_for_metadata
=
false
self
.
waiting_for_articles
=
false
})
},
watch
:
{
...
...
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