• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ecamp / hal-json-vuex / 4044415582

pending completion
4044415582

Pull #280

github

GitHub
Merge 4f06dbcf7 into 0e348e243
Pull Request #280: Fix baseUrl usage of axios

139 of 164 branches covered (84.76%)

Branch coverage included in aggregate %.

18 of 18 new or added lines in 2 files covered. (100.0%)

300 of 319 relevant lines covered (94.04%)

422.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/storeModule.ts
1
import Vue from 'vue'
3✔
2
import StoreData from './interfaces/StoreData'
3

4
import { MutationTree } from 'vuex/types'
5

6
export const state = {}
3✔
7
export type State = Record<string, StoreData>
8

9
export const mutations: MutationTree<State> = {
3✔
10
  /**
11
   * Adds a placeholder into the store that indicates that the entity with the given URI is currently being
12
   * fetched from the API and not yet available.
13
   * @param state Vuex state
14
   * @param uri   URI of the object that is being fetched
15
   */
16
  addEmpty (state: State, uri: string) : void {
17
    Vue.set(state, uri, { _meta: { self: uri, loading: true } })
5,285✔
18
  },
19
  /**
20
   * Adds entities loaded from the API to the Vuex store.
21
   * @param state Vuex state
22
   * @param data  An object mapping URIs to entities that should be merged into the Vuex state.
23
   */
24
  add (state: State, data: Record<string, unknown>) : void {
25
    Object.keys(data).forEach(uri => {
5,763✔
26
      Vue.set(state, uri, data[uri])
9,926✔
27

28
      Vue.set(state[uri]._meta, 'loading', false)
9,926✔
29
      Vue.set(state[uri]._meta, 'reloading', false)
9,926✔
30
    })
31
  },
32
  /**
33
   * Marks a single entity in the Vuex store as reloading, meaning a reloading network request is currently ongoin.
34
   * @param state Vuex state
35
   * @param uri   URI of the entity that is currently being reloaded
36
   */
37
  reloading (state: State, uri: string) : void {
38
    if (state[uri]) Vue.set(state[uri]._meta, 'reloading', true)
1,457✔
39
  },
40
  /**
41
   * Marks a single entity in the Vuex store as normal again, after it has been marked as reloading before.
42
   * @param state Vuex state
43
   * @param uri   URI of the entity that is currently being reloaded
44
   */
45
  reloadingFailed (state: State, uri: string) : void {
46
    if (state[uri]) Vue.set(state[uri]._meta, 'reloading', false)
452✔
47
  },
48
  /**
49
   * Removes a single entity from the Vuex store.
50
   * @param state Vuex state
51
   * @param uri   URI of the entity to be removed
52
   */
53
  purge (state: State, uri: string) : void {
54
    Vue.delete(state, uri)
1,487✔
55
  },
56
  /**
57
   * Removes all entities from the Vuex store.
58
   * @param state Vuex state
59
   * @param uri   URI of the entity to be removed
60
   */
61
  purgeAll (state: State) : void {
62
    Object.keys(state).forEach(uri => {
×
63
      Vue.delete(state, uri)
×
64
    })
65
  },
66
  /**
67
   * Marks a single entity in the Vuex store as deleting, meaning the process of deletion is currently ongoing.
68
   * @param state Vuex state
69
   * @param uri   URI of the entity that is currently being deleted
70
   */
71
  deleting (state: State, uri: string) : void {
72
    if (state[uri]) Vue.set(state[uri]._meta, 'deleting', true)
1,389✔
73
  },
74
  /**
75
   * Marks a single entity in the Vuex store as normal again, after it has been marked as deleting before.
76
   * @param state Vuex state
77
   * @param uri   URI of the entity that failed to be deleted
78
   */
79
  deletingFailed (state: State, uri: string) : void {
80
    if (state[uri]) Vue.set(state[uri]._meta, 'deleting', false)
×
81
  }
82
}
83

84
export default {
3✔
85
  mutations
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc