JSFiddle - React, Tailwind, and code Playground

by batcave

JavaScript

created() {
  if (this.$route.params.userId === undefined) {
    this.user.id = uuid();
    ...
  } else {
    if (this.users.length > 0) {
				this.user = this.users[this.$route.params.userId];
			} else {
				this.$store.dispatch('fetchUsers').then(() => {
					this.user = this.users[this.$route.params.userId];
				});
			}
  }
}