<template>
  <button type="button" class="btn btn-primary" @click.stop="testRedirect">
    Test redirect
  </button>
</template>
<script>
import RedirectApi from '../../api/redirect-api';

export default{
  props: {
    item: {
      type: Object,
    },
  },
  methods: {
    async testRedirect() {
      const item = this.item['$item'];
      const url = item.to.url || await RedirectApi.getAbsoluteUrlForOriginPath(item.from);

      window.open(url);
    },
  },
};
</script>
