resources/js/frontend/store/modules/upload.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1

Size

Lines of Code 43
Function Count 8

Duplication

Duplicated Lines 43
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 23
c 0
b 0
f 0
dl 43
loc 43
rs 10
wmc 8
mnd 0
bc 0
fnc 8
bpm 0
cpm 1
noi 0

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1 View Code Duplication
import axios from 'axios'
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
import Cookies from 'js-cookie'
3
import * as types from '../mutation-types'
4
5
// state
6
export const state = {
7
  code: null,
8
  uploader: null
9
}
10
11
// getters
12
export const getters = {
13
  code: state => state.code,
14
  uploader: state => state.uploader,
15
}
16
17
// mutations
18
export const mutations = {
19
20
  [types.CODE_SAVE] (state, { code }) {
21
    state.code = code
22
  },
23
  [types.CODE_UPDATE] (state, { code }) {
24
    state.code = code
25
  },
26
  [types.Uploader] (state, { uploader }) {
27
    state.uploader = uploader
28
  }
29
}
30
31
// actions
32
export const actions = {
33
  saveCode ({ commit, dispatch }, payload) {
34
    commit(types.CODE_SAVE, payload)
35
  },
36
37
  updateCode ({ commit }, payload) {
38
    commit(types.CODE_UPDATE, payload)
39
  },
40
  setUploader: function({commit, dispatch}, payload) {
41
    commit(types.Uploader, payload)
42
  },
43
}
44