diff --git a/app/controllers/register.js b/app/controllers/register.js index be00a3b69..38a0fb4fe 100644 --- a/app/controllers/register.js +++ b/app/controllers/register.js @@ -1,6 +1,7 @@ import { inject as service } from '@ember/service' import { computed } from '@ember/object' import Controller from '@ember/controller' +import { sendRouteToParent } from '../router' export default Controller.extend({ avatardb: service(), @@ -58,7 +59,7 @@ export default Controller.extend({ actions: { doRegister() { this.pilasBloquesApi.register(this.registerData) - .then(() => this.transitionToRoute("/")) + .then(() => sendRouteToParent()) }, checkUsername() { diff --git a/app/router.js b/app/router.js index 38366d4e2..f4618edb6 100644 --- a/app/router.js +++ b/app/router.js @@ -2,7 +2,9 @@ import EmberRouter from '@ember/routing/router'; import config from 'pilasbloques/config/environment'; -function sendRouteToParent(route) { +export function sendRouteToParent(hash) { + const route = hash ? hash : '#/' + //The if is necessary so that imported challenges do not redirect to desafio/react-imported-challenge on react if (!route.includes('react-imported-challenge')) window.parent.postMessage({ route }, '*'); }