You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-csc-ui/src/store/dashboard.js

48 lines
1.6 KiB

import { LIST_DEFAULT_ROWS } from 'src/api/common'
import { getAllCallsOrVoicemails } from 'src/api/conversations'
import { getSubscriberRegistrations } from 'src/api/subscriber'
import { getBrowserTimezone } from 'src/helpers/date-helper'
export default {
namespaced: true,
getters: {
getSubscriberId (state, getters, rootState, rootGetters) {
return parseInt(rootGetters['user/getSubscriberId'])
}
},
actions: {
async getVoicemailsData (context) {
const res = await getAllCallsOrVoicemails({
subscriber_id: context.getters.getSubscriberId,
rows: LIST_DEFAULT_ROWS,
order_by: 'timestamp',
order_by_direction: 'desc',
type: 'voicemail',
tz: getBrowserTimezone()
})
return res
},
async getCallsData (context) {
const res = await getAllCallsOrVoicemails({
subscriber_id: context.getters.getSubscriberId,
rows: LIST_DEFAULT_ROWS,
order_by: 'timestamp',
order_by_direction: 'desc',
type: 'call',
tz: 'UTC'
})
return res
},
async getRegisteredDevicesData (context) {
const res = await getSubscriberRegistrations({
subscriber_id: context.getters.getSubscriberId,
rows: LIST_DEFAULT_ROWS,
order_by: 'timestamp',
order_by_direction: 'desc',
tz: getBrowserTimezone()
})
return res
}
}
}