Commit 19f65107 authored by Hidde-Jan Jongsma's avatar Hidde-Jan Jongsma

Fix redirect

parent e71eb653
......@@ -16,7 +16,7 @@ import axios from "axios";
import ConnectorSelect from "./ConnectorSelect.vue";
const WAIT_TIME = 1000;
const WAIT_TIME = 200;
export default {
name: "CredentialRequest",
......
......@@ -9,7 +9,7 @@
no-close-on-backdrop
hide-header-close
@cancel="(status = 'cancelled') && $emit('cancel')"
@ok="(status = 'success') && $emit('success')"
@ok="handleOk"
>
<p class="text-center">
<img :src="qr" alt="Could not render QR code..." />
......@@ -19,7 +19,7 @@
</template>
<script>
const WAIT_TIME = 1000;
const WAIT_TIME = 200;
export default {
name: "JolocomIssue",
......@@ -35,13 +35,12 @@ export default {
},
data() {
return {
status: "started",
modal: false,
status: "loading",
};
},
computed: {
showModal() {
return this.status === "started" && this.modal;
return this.status === "started";
},
},
mounted() {
......@@ -50,7 +49,14 @@ export default {
},
methods: {
showQR() {
this.modal = true;
this.status = "started";
},
handleOk() {
this.status = "success";
this.$emit("success", {
requestId: this.requestId,
connector: "jolocom",
});
},
},
};
......
......@@ -60,7 +60,8 @@ const noticeMap = {
success: "Success! We'll redirect you shortly.",
};
const WAIT_TIME = 1000;
const WAIT_TIME = 200;
const REDIRECT_WAIT_TIME = 1000;
export default {
name: "PerformCredentialRequest",
......@@ -124,11 +125,11 @@ export default {
redirect({ status, redirectUrl }) {
console.log("Received redirect", status, redirectUrl);
this.status = status;
setTimeout(() => (window.location = redirectUrl), WAIT_TIME);
setTimeout(() => (window.location = redirectUrl), REDIRECT_WAIT_TIME);
},
},
created() {
setTimeout(this.performRequest.bind(this), WAIT_TIME);
this.performRequest();
},
mounted() {
if (!this.socketConnected) {
......@@ -169,8 +170,8 @@ export default {
this.$socket.client.emit("request-error", this.requestId);
this.status = "error";
},
success() {
this.$socket.client.emit("request-success", this.requestId);
success(data) {
this.$socket.client.emit("request-success", data);
this.status = "success";
},
},
......
......@@ -173,6 +173,7 @@ export default {
},
methods: {
async createToken() {
this.token = "";
try {
const data = {
type: this.credentialType,
......
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