Converts the canned-response and agent API clients to CacheEnabledApiClient subclasses and wires revalidate actions into the corresponding Vuex modules, so settings pages and pickers stop fetching the same lists on every visit. The canned-response search box continues to bypass the cache and hit the network directly, so server-side ordering stays authoritative. Also fixes a pre-existing gap in teams/revalidate: SET_TEAMS merges into a record dict by id and never removes missing entries, so a team deleted server-side would survive a reconnect-driven revalidate. Now matches the get action by emitting CLEAR_TEAMS first. Each affected spec clears its IDB store before every case, since the preflight-throws-on-axios-reject pattern they relied on is going away in the next commit.
33 lines
686 B
JavaScript
33 lines
686 B
JavaScript
/* global axios */
|
|
|
|
import CacheEnabledApiClient from './CacheEnabledApiClient';
|
|
|
|
class Agents extends CacheEnabledApiClient {
|
|
constructor() {
|
|
super('agents', { accountScoped: true });
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
get cacheModelName() {
|
|
return 'account_user';
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
extractDataFromResponse(response) {
|
|
return response.data;
|
|
}
|
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
marshallData(dataToParse) {
|
|
return { data: dataToParse };
|
|
}
|
|
|
|
bulkInvite({ emails }) {
|
|
return axios.post(`${this.url}/bulk_create`, {
|
|
emails,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default new Agents();
|