import { Component, Mixins } from 'vue-property-decorator';
import Vue from 'vue';
import get from 'lodash/get';
import { oidcClientComputed } from '@state/modules/oidc-client';

const oidcClientMixin = Vue.extend({
  computed: {
    ...oidcClientComputed,
  },
});

@Component({})
export default class RegionsCreate extends Mixins(oidcClientMixin) {
  processKey = 'CreateRegionIDMProcess';

  created() {
    const organizationId = get(this.currentUser, 'domain_id');

    this.$store.dispatch('wf/processes/dispatchProcess', {
      processKey: this.processKey,
      data: {
        managedId: organizationId,
        redirectUrl: '/regions',
      },
    });
  }
}
