diff --git a/frontend/components/containers/members/MemberAdditionButton.vue b/frontend/components/containers/members/MemberAdditionButton.vue index 2173566f..f00c7ce6 100644 --- a/frontend/components/containers/members/MemberAdditionButton.vue +++ b/frontend/components/containers/members/MemberAdditionButton.vue @@ -48,7 +48,7 @@ export default { searchUser(username) { UserService.getUserList(username) .then((response) => { - this.items = response + this.items = response.data }) .catch((error) => { alert(error) diff --git a/frontend/components/organisms/auth/LoginForm.vue b/frontend/components/organisms/auth/LoginForm.vue index 76138562..02e416c0 100644 --- a/frontend/components/organisms/auth/LoginForm.vue +++ b/frontend/components/organisms/auth/LoginForm.vue @@ -62,13 +62,15 @@ export default { validate() { return this.$refs.form.validate() }, - async tryLogin() { + tryLogin() { if (this.validate()) { - await this.login({ + this.login({ username: this.username, password: this.password }) - this.$router.push('/projects') + .then((result) => { + this.$router.push('/projects') + }) } } } diff --git a/frontend/services/api.service.js b/frontend/services/api.service.js index 7ab48d4a..8e39f9dd 100644 --- a/frontend/services/api.service.js +++ b/frontend/services/api.service.js @@ -23,8 +23,8 @@ class ApiService { data, ...config }) - .then(response => response.data) - .catch(error => error) + // .then(response => response.data) + // .catch(error => error) } get(url, config = {}) { diff --git a/frontend/store/auth.js b/frontend/store/auth.js index ea3c70f8..4de7b5ad 100644 --- a/frontend/store/auth.js +++ b/frontend/store/auth.js @@ -25,10 +25,10 @@ export const actions = { authenticateUser({ commit }, authData) { return AuthService.postCredential(authData) .then((result) => { - commit('setToken', result.token) - localStorage.setItem('token', result.token) - Cookie.set('jwt', result.token) - ApiService.setHeader(result.token) + commit('setToken', result.data.token) + localStorage.setItem('token', result.data.token) + Cookie.set('jwt', result.data.token) + ApiService.setHeader(result.data.token) }) .catch(e => alert(e)) }, diff --git a/frontend/store/documents.js b/frontend/store/documents.js index c4ebfb3b..aa8bfd35 100644 --- a/frontend/store/documents.js +++ b/frontend/store/documents.js @@ -91,8 +91,8 @@ export const actions = { payload = Object.assign(payload, state.searchOptions) return DocumentService.getDocumentList(payload) .then((response) => { - commit('setDocumentList', response.results) - commit('setTotalItems', response.count) + commit('setDocumentList', response.data.results) + commit('setTotalItems', response.data.count) }) .catch((error) => { alert(error) @@ -126,7 +126,7 @@ export const actions = { commit('setLoading', true) DocumentService.exportFile(data.projectId, data.format) .then((response) => { - const url = window.URL.createObjectURL(new Blob([response])) + const url = window.URL.createObjectURL(new Blob([response.data])) const link = document.createElement('a') link.href = url link.setAttribute('download', 'file.' + data.format) @@ -143,7 +143,7 @@ export const actions = { updateDocument({ commit }, data) { DocumentService.updateDocument(data.projectId, data.id, data) .then((response) => { - commit('updateDocument', response) + commit('updateDocument', response.data) }) .catch((error) => { alert(error) @@ -165,7 +165,7 @@ export const actions = { const documentId = state.items[state.current].id AnnotationService.addAnnotation(payload.projectId, documentId, payload) .then((response) => { - commit('addAnnotation', response) + commit('addAnnotation', response.data) }) .catch((error) => { alert(error) @@ -175,7 +175,7 @@ export const actions = { const documentId = state.items[state.current].id AnnotationService.updateAnnotation(payload.projectId, documentId, payload.annotationId, payload) .then((response) => { - commit('updateAnnotation', response) + commit('updateAnnotation', response.data) }) .catch((error) => { alert(error) @@ -198,7 +198,7 @@ export const actions = { } DocumentService.approveDocument(payload.projectId, documentId, data) .then((response) => { - commit('updateDocument', response) + commit('updateDocument', response.data) }) .catch((error) => { alert(error) diff --git a/frontend/store/labels.js b/frontend/store/labels.js index 5bfdd7cd..1a80820e 100644 --- a/frontend/store/labels.js +++ b/frontend/store/labels.js @@ -42,7 +42,7 @@ export const actions = { commit('setLoading', true) return LabelService.getLabelList(payload.projectId) .then((response) => { - commit('setLabelList', response) + commit('setLabelList', response.data) }) .catch((error) => { alert(error) @@ -54,7 +54,7 @@ export const actions = { createLabel({ commit }, data) { LabelService.addLabel(data.projectId, data) .then((response) => { - commit('addLabel', response) + commit('addLabel', response.data) }) .catch((error) => { alert(error) @@ -63,7 +63,7 @@ export const actions = { updateLabel({ commit }, data) { LabelService.updateLabel(data.projectId, data.id, data) .then((response) => { - commit('updateLabel', response) + commit('updateLabel', response.data) }) .catch((error) => { alert(error) diff --git a/frontend/store/members.js b/frontend/store/members.js index 3fdce6cf..ee13b3ae 100644 --- a/frontend/store/members.js +++ b/frontend/store/members.js @@ -42,7 +42,7 @@ export const actions = { commit('setLoading', true) return MemberService.getMemberList(payload.projectId) .then((response) => { - commit('setMemberList', response) + commit('setMemberList', response.data) }) .catch((error) => { alert(error) @@ -54,7 +54,7 @@ export const actions = { addMember({ commit }, data) { MemberService.addMember(data.projectId, data.userId, data.role) .then((response) => { - commit('addMember', response) + commit('addMember', response.data) }) .catch((error) => { alert(error) @@ -63,7 +63,7 @@ export const actions = { updateMemberRole({ commit }, member) { MemberService.updateMemberRole(member.projectId, member.id, member.role) .then((response) => { - commit('updateMember', response) + commit('updateMember', response.data) }) .catch((error) => { alert(error) diff --git a/frontend/store/projects.js b/frontend/store/projects.js index e8ceb899..8523c5fc 100644 --- a/frontend/store/projects.js +++ b/frontend/store/projects.js @@ -226,7 +226,7 @@ export const actions = { commit('setLoading', true) ProjectService.getProjectList() .then((response) => { - commit('setProjectList', response) + commit('setProjectList', response.data) }) .catch((error) => { alert(error) @@ -238,7 +238,7 @@ export const actions = { createProject({ commit }, project) { ProjectService.createProject(project) .then((response) => { - commit('createProject', response) + commit('createProject', response.data) }) .catch((error) => { alert(error) @@ -247,7 +247,7 @@ export const actions = { updateProject({ commit }, data) { ProjectService.updateProject(data.projectId, data) .then((response) => { - commit('updateProject', response) + commit('updateProject', response.data) }) .catch((error) => { alert(error) @@ -268,7 +268,7 @@ export const actions = { setCurrentProject({ commit }, projectId) { return ProjectService.fetchProjectById(projectId) .then((response) => { - commit('setCurrent', response) + commit('setCurrent', response.data) }) .catch((error) => { alert(error) @@ -277,7 +277,7 @@ export const actions = { updateCurrentProject({ commit }, data) { ProjectService.updateProject(data.projectId, data) .then((response) => { - commit('setCurrent', response) + commit('setCurrent', response.data) }) .catch((error) => { alert(error) diff --git a/frontend/store/roles.js b/frontend/store/roles.js index 79d0a705..55ae28f4 100644 --- a/frontend/store/roles.js +++ b/frontend/store/roles.js @@ -25,7 +25,7 @@ export const actions = { commit('setLoading', true) return RoleService.getRoleList() .then((response) => { - commit('setRoleList', response) + commit('setRoleList', response.data) }) .catch((error) => { alert(error) diff --git a/frontend/store/statistics.js b/frontend/store/statistics.js index c84481ae..de7e788f 100644 --- a/frontend/store/statistics.js +++ b/frontend/store/statistics.js @@ -56,7 +56,7 @@ export const actions = { commit('setLoading', true) StatisticsService.getStatistics(payload) .then((response) => { - commit('setStatistics', response) + commit('setStatistics', response.data) }) .catch((error) => { alert(error)