Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return promises in onsubmit #2589

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/src/admin/components/AppearancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class AppearancePage extends Page {

this.loading = true;

saveSettings({
return saveSettings({
theme_primary_color: this.primaryColor(),
theme_secondary_color: this.secondaryColor(),
theme_dark_mode: this.darkMode(),
Expand Down
2 changes: 1 addition & 1 deletion js/src/admin/components/BasicsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default class BasicsPage extends Page {

this.fields.forEach((key) => (settings[key] = this.values[key]()));

saveSettings(settings)
return saveSettings(settings)
.then(() => {
this.successAlert = app.alerts.show({ type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));
})
Expand Down
2 changes: 1 addition & 1 deletion js/src/admin/components/EditGroupModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default class EditGroupModal extends Modal {

this.loading = true;

this.group
return this.group
.save(this.submitData(), { errorHandler: this.onerror.bind(this) })
.then(this.hide.bind(this))
.catch(() => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/admin/components/MailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default class MailPage extends Page {

this.fields.forEach((key) => (settings[key] = this.values[key]()));

saveSettings(settings)
return saveSettings(settings)
.then(() => {
this.successAlert = app.alerts.show({ type: 'success' }, app.translator.trans('core.admin.basics.saved_message'));
})
Expand Down
2 changes: 1 addition & 1 deletion js/src/admin/components/SettingsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class SettingsModal extends Modal {

this.loading = true;

saveSettings(this.dirty()).then(this.onsaved.bind(this), this.loaded.bind(this));
return saveSettings(this.dirty()).then(this.onsaved.bind(this), this.loaded.bind(this));
}

onsaved() {
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/ChangeEmailModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class ChangeEmailModal extends Modal {
this.loading = true;
this.alertAttrs = null;

app.session.user
return app.session.user
.save(
{ email: this.email() },
{
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/ChangePasswordModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class ChangePasswordModal extends Modal {

this.loading = true;

app
return app
.request({
method: 'POST',
url: app.forum.attribute('apiUrl') + '/forgot',
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/DiscussionComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class DiscussionComposer extends ComposerBody {

const data = this.data();

app.store
return app.store
.createRecord('discussions')
.save(data)
.then((discussion) => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/EditPostComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class EditPostComposer extends ComposerBody {

const data = this.data();

this.attrs.post.save(data).then((post) => {
return this.attrs.post.save(data).then((post) => {
// If we're currently viewing the discussion which this edit was made
// in, then we can scroll to the post.
if (app.viewingDiscussion(discussion)) {
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/EditUserModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default class EditUserModal extends Modal {

this.loading = true;

this.attrs.user
return this.attrs.user
.save(this.data(), { errorHandler: this.onerror.bind(this) })
.then(this.hide.bind(this))
.catch(() => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/ForgotPasswordModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class ForgotPasswordModal extends Modal {

this.loading = true;

app
return app
.request({
method: 'POST',
url: app.forum.attribute('apiUrl') + '/forgot',
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/LogInModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default class LogInModal extends Modal {
const password = this.password();
const remember = this.remember();

app.session
return app.session
.login({ identification, password, remember }, { errorHandler: this.onerror.bind(this) })
.then(() => window.location.reload(), this.loaded.bind(this));
}
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/ReplyComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class ReplyComposer extends ComposerBody {

const data = this.data();

app.store
return app.store
.createRecord('posts')
.save(data)
.then((post) => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/SignUpModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class SignUpModal extends Modal {

const body = this.submitData();

app
return app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t this be pointless/need more changes since the window is reloaded? Any then statement after wouldn’t be able to run.

.request({
url: app.forum.attribute('baseUrl') + '/register',
method: 'POST',
Expand Down