Commit ac2f4b05 authored by Peter Langenkamp's avatar Peter Langenkamp

add organization registration page

parent 19f65107
<template>
<div>
<b-form @submit.prevent="registerOrganization">
<b-form-group label="Name:">
<b-form-input
v-model="organization.name"
name="organization[name]"
required
placeholder="Enter name"
></b-form-input>
</b-form-group>
<b-button type="submit" variant="primary">Submit</b-button>
</b-form>
<b-card class="mt-3" header="Registration Response">
<pre class="registration-output">{{ registrationResponse }}</pre>
<p v-if="token" class="m-0"></p>
</b-card>
</div>
</template>
<script>
import axios from "axios";
export default {
name: "RegisterOrganizationForm",
data() {
return {
organization: {
name: "",
},
registrationResponse: null,
};
},
methods: {
async registerOrganization() {
this.registrationResponse = null;
try {
const data = this.organization;
const response = await axios.post("/api/organizations", data);
console.log(response.data);
this.registrationResponse = response.data;
} catch (e) {
console.error(e);
}
},
},
};
</script>
<style scoped>
.registration-output {
white-space: pre-wrap;
}
</style>
......@@ -4,6 +4,7 @@ import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Utils from "../views/Utils.vue";
import CreateToken from "../views/utils/CreateToken.vue";
import RegisterOrganization from "../views/utils/RegisterOrganization.vue";
import CreateIssueRequest from "../views/CreateIssueRequest.vue";
import CreateVerifyRequest from "../views/CreateVerifyRequest.vue";
......@@ -31,6 +32,11 @@ const routes = [
name: "CreateToken",
component: CreateToken,
},
{
path: "/utils/register-organization",
name: "RegisterOrganization",
component: RegisterOrganization,
},
],
},
{
......
......@@ -6,7 +6,9 @@
<b-navbar-nav>
<b-nav-item :to="{ name: 'CreateToken' }">Create token</b-nav-item>
<b-nav-item href="#" disabled>Organizations</b-nav-item>
<b-nav-item :to="{ name: 'RegisterOrganization' }"
>Organizations</b-nav-item
>
<b-nav-item href="#" disabled>Credential types</b-nav-item>
<b-nav-item href="#" disabled>Jolocom types</b-nav-item>
</b-navbar-nav>
......
<template>
<div>
<h1>Register Organization</h1>
<register-organization-form></register-organization-form>
<!-- <create-token-form></create-token-form>
<hr />
<h1>Debug token</h1>
<create-request-form></create-request-form>
<hr />-->
</div>
</template>
<script>
import RegisterOrganizationForm from "../../components/utils/RegisterOrganizationForm.vue";
export default {
name: "RegisterOrganization",
components: {
RegisterOrganizationForm,
},
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment