Commit 9d453d0d authored by Jörg Richter's avatar Jörg Richter

REST client: suppress error handler for certain requests

See dmx-platform/dmx-platform#283
parent 40cda8ff
Pipeline #7797 passed with stage
in 2 seconds
This diff is collapsed.
......@@ -6,7 +6,7 @@ import typeCache from './type-cache'
import permCache from './permission-cache'
import utils from './utils'
console.log('[DMX] Client API 2019/08/01')
console.log('[DMX] Client API 2019/08/06')
export default {
......
......@@ -2,6 +2,10 @@ import http from 'axios'
import utils from './utils'
import { Topic, Assoc, RelatedTopic, TopicType, AssocType, Topicmap, Geomap } from './model'
// Vanilla instance without error interceptor.
// In contrast the default http instance allows the caller to set an error handler (see setErrorHandler()).
const _http = http.create()
export default {
// === Core ===
......@@ -48,7 +52,8 @@ export default {
},
queryTopicsFulltext (query, typeUri) {
return http.get('/core/topic', {params: {query, type_uri: typeUri}}).then(response => ({
// suppress error handler as for incremental search the query might be (temporarily) syntactically incorrect
return _http.get('/core/topic', {params: {query, type_uri: typeUri}}).then(response => ({
query: response.data.query,
topics: utils.instantiateMany(response.data.topics, Topic)
}))
......@@ -350,7 +355,8 @@ export default {
* @param credentials object with 'username' and 'password' props
*/
login (credentials, authMethod = 'Basic') {
return http.post('/accesscontrol/login', undefined, {
// suppress error handler as the client application is supposed to present the error to the user specially
return _http.post('/accesscontrol/login', undefined, {
headers: {
'Authorization': authMethod + ' ' + btoa(credentials.username + ':' + credentials.password)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment