forked from AkkomaGang/admin-fe
Rename action that sets reports filter
This commit is contained in:
parent
13ace35a3c
commit
1899450dc1
3 changed files with 8 additions and 8 deletions
|
@ -52,7 +52,7 @@ const reports = {
|
||||||
commit('SET_PAGE', page)
|
commit('SET_PAGE', page)
|
||||||
commit('SET_LOADING', false)
|
commit('SET_LOADING', false)
|
||||||
},
|
},
|
||||||
SetFilter({ commit }, filter) {
|
SetReportsFilter({ commit }, filter) {
|
||||||
commit('SET_REPORTS_FILTER', filter)
|
commit('SET_REPORTS_FILTER', filter)
|
||||||
},
|
},
|
||||||
CreateReportNote({ commit, getters, state, rootState }, { content, reportID }) {
|
CreateReportNote({ commit, getters, state, rootState }, { content, reportID }) {
|
||||||
|
|
|
@ -38,11 +38,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$store.dispatch('SetFilter', this.$data.filter)
|
this.$store.dispatch('SetReportsFilter', this.$data.filter)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleFilters() {
|
toggleFilters() {
|
||||||
this.$store.dispatch('SetFilter', this.$data.filter)
|
this.$store.dispatch('SetReportsFilter', this.$data.filter)
|
||||||
this.$store.dispatch('ClearFetchedReports')
|
this.$store.dispatch('ClearFetchedReports')
|
||||||
this.$store.dispatch('FetchReports', 1)
|
this.$store.dispatch('FetchReports', 1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ describe('Reports filter', () => {
|
||||||
it('shows open reports when "Open" filter is applied', async (done) => {
|
it('shows open reports when "Open" filter is applied', async (done) => {
|
||||||
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
||||||
|
|
||||||
store.dispatch('SetFilter', 'open')
|
store.dispatch('SetReportsFilter', 'open')
|
||||||
store.dispatch('ClearFetchedReports')
|
store.dispatch('ClearFetchedReports')
|
||||||
store.dispatch('FetchReports', 1)
|
store.dispatch('FetchReports', 1)
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
@ -38,7 +38,7 @@ describe('Reports filter', () => {
|
||||||
it('shows resolved reports when "Resolved" filter is applied', async (done) => {
|
it('shows resolved reports when "Resolved" filter is applied', async (done) => {
|
||||||
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
||||||
|
|
||||||
store.dispatch('SetFilter', 'resolved')
|
store.dispatch('SetReportsFilter', 'resolved')
|
||||||
store.dispatch('ClearFetchedReports')
|
store.dispatch('ClearFetchedReports')
|
||||||
store.dispatch('FetchReports')
|
store.dispatch('FetchReports')
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
@ -50,7 +50,7 @@ describe('Reports filter', () => {
|
||||||
it('shows closed reports when "Closed" filter is applied', async (done) => {
|
it('shows closed reports when "Closed" filter is applied', async (done) => {
|
||||||
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
||||||
|
|
||||||
store.dispatch('SetFilter', 'closed')
|
store.dispatch('SetReportsFilter', 'closed')
|
||||||
store.dispatch('ClearFetchedReports')
|
store.dispatch('ClearFetchedReports')
|
||||||
store.dispatch('FetchReports')
|
store.dispatch('FetchReports')
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
@ -62,13 +62,13 @@ describe('Reports filter', () => {
|
||||||
it('shows all users after removing filters', async (done) => {
|
it('shows all users after removing filters', async (done) => {
|
||||||
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
expect(store.state.reports.fetchedReports.length).toEqual(7)
|
||||||
|
|
||||||
store.dispatch('SetFilter', 'open')
|
store.dispatch('SetReportsFilter', 'open')
|
||||||
store.dispatch('ClearFetchedReports')
|
store.dispatch('ClearFetchedReports')
|
||||||
store.dispatch('FetchReports')
|
store.dispatch('FetchReports')
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
expect(store.state.reports.fetchedReports.length).toEqual(2)
|
expect(store.state.reports.fetchedReports.length).toEqual(2)
|
||||||
|
|
||||||
store.dispatch('SetFilter', '')
|
store.dispatch('SetReportsFilter', '')
|
||||||
store.dispatch('ClearFetchedReports')
|
store.dispatch('ClearFetchedReports')
|
||||||
store.dispatch('FetchReports')
|
store.dispatch('FetchReports')
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
Loading…
Reference in a new issue