Skip to content

Commit

Permalink
Fix signup not working
Browse files Browse the repository at this point in the history
* The API request was not passing the body properly
* Removed user find request (fails if guests don't have permission) - uses register response now
  • Loading branch information
dsevillamartin committed Aug 21, 2023
1 parent 926a31b commit b1c7c84
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@ app.initializers.add('fof-realtimelogin', () => {

this.loading = true;

const data = this.submitData();
const body = this.submitData();

await app.request({
url: app.forum.attribute('baseUrl') + '/register',
method: 'POST',
data,
errorHandler: this.onerror.bind(this),
});
const payload = await app
.request({
url: app.forum.attribute('baseUrl') + '/register',
method: 'POST',
body,
errorHandler: this.onerror.bind(this),
})
.catch(this.loaded.bind(this));

const user = await app.store.find('users', {
filter: { username: data.username },
page: { limit: 1 },
});
if (!payload) return;

app.store.pushPayload(payload);
app.session.user = app.store.getById('users', payload.data.id);

app.session.user = user[0];
await loadBaseApiData();

alertEmailConfirmation(app);
Expand Down

0 comments on commit b1c7c84

Please sign in to comment.