Skip to content
Snippets Groups Projects
Commit f77e88b2 authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

New store module for student-data

parent 62390dda
No related branches found
No related tags found
1 merge request!23Resolve "Logout of tutors after inactivity"
import ax from '../api'
const studentPage = {
state: {
studentName: '',
exam: {},
submissionTypes: [],
submissions: []
},
mutations: {
'SET_STUDENT_NAME': function (state, name) {
state.studentName = name
},
'SET_EXAM': function (state, exam) {
state.exam = exam
},
'SET_SUBMISSION_TYPES': function (state, submissionTypes) {
state.submissionTypes = submissionTypes
},
'SET_SUBMISSIONS': function (state, submissions) {
state.submissions = submissions
}
},
actions: {
getStudentData (context) {
ax.get('api/student-page/').then(response => {
const data = response.data
context.commit('SET_STUDENT_NAME', data.name)
context.commit('SET_EXAM', data.exam)
context.commit('SET_SUBMISSIONS', data.submissions)
})
}
}
}
export default studentPage
......@@ -4,12 +4,14 @@ import ax from './api'
import gradySays from './grady_speak'
import submissionNotes from './modules/submission-notes'
import studentPage from './modules/student-page'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
submissionNotes: submissionNotes
submissionNotes,
studentPage
},
state: {
token: '',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment