export default {
  computed: {
    cacheKey() {
      return this.$route.name
    }
  },
  methods: {
    cacheSetStepData(key, data) {
      window.sessionStorage.setItem(key, JSON.stringify(data))
    },
    cacheGetStepData(key) {
      try {
        const ret = JSON.parse(window.sessionStorage.getItem(key))
        return ret
      } catch (e) {
        return null
      }
    },
    cacheDelStepData(key) {
      window.sessionStorage.removeItem(key)
    },

    isValidObject(obj) {
      return typeof obj === 'object' && obj !== null
    },
    cloneObject(obj) {
      return JSON.parse(JSON.stringify(obj))
    }
  }
}
