diff --git a/src/store.js b/src/store.js index 4f3e97dbb..5b881c63e 100644 --- a/src/store.js +++ b/src/store.js @@ -48,6 +48,7 @@ import bugReports from '@/store/bugReports/collection'; import bugReport from '@/store/bugReports/document'; import releases from '@/store/releases'; +import candidateSettings from '@/store/candidateSettings'; //const store = new Vuex.Store({ const store = createStore({ @@ -94,6 +95,7 @@ const store = createStore({ vacancy, bugReport, bugReports, + candidateSettings, }, state: { packageVersion: import.meta.env.PACKAGE_VERSION || '0', diff --git a/src/store/candidateSettings.js b/src/store/candidateSettings.js new file mode 100644 index 000000000..19091761a --- /dev/null +++ b/src/store/candidateSettings.js @@ -0,0 +1,30 @@ +import { doc } from '@firebase/firestore'; +import { firestore } from '@/firebase'; +import { firestoreAction } from '@/helpers/vuexfireJAC'; +import vuexfireSerialize from '@jac-uk/jac-kit/helpers/vuexfireSerialize'; + +export default { + namespaced: true, + actions: { + bind: firestoreAction(({ bindFirestoreRef }) => { + const firestoreRef = doc(firestore, 'settings/candidateSettings'); + return bindFirestoreRef('record', firestoreRef, { serialize: vuexfireSerialize }); + }), + unbind: firestoreAction(({ unbindFirestoreRef }) => { + return unbindFirestoreRef('record'); + }), + }, + mutations: { + set(state, { name, value }) { + state[name] = value; + }, + }, + state: { + record: null, + }, + getters: { + getUploadStatus: (state) => { + return state.record && state.record.fileUpload.enabled; + }, + }, +}; diff --git a/src/views/ReleasesList.vue b/src/views/ReleasesList.vue index dba4e0bf5..44c845696 100644 --- a/src/views/ReleasesList.vue +++ b/src/views/ReleasesList.vue @@ -1,5 +1,12 @@