Skip to content

Commit

Permalink
fixing register route
Browse files Browse the repository at this point in the history
  • Loading branch information
dlopezalvas committed Oct 3, 2023
1 parent 6e0d140 commit a699c31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/register.js
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down Expand Up @@ -58,7 +59,7 @@ export default Controller.extend({
actions: {
doRegister() {
this.pilasBloquesApi.register(this.registerData)
.then(() => this.transitionToRoute("/"))
.then(() => sendRouteToParent())
},

checkUsername() {
Expand Down
4 changes: 3 additions & 1 deletion app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }, '*');
}

Expand Down

0 comments on commit a699c31

Please sign in to comment.