This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/associate-account-confirm.js.es6

28 lines
785 B
JavaScript

import Controller from "@ember/controller";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import ModalFunctionality from "discourse/mixins/modal-functionality";
export default Controller.extend(ModalFunctionality, {
actions: {
finishConnect() {
ajax({
url: `/associate/${encodeURIComponent(this.model.token)}`,
type: "POST"
})
.then(result => {
if (result.success) {
this.transitionToRoute(
"preferences.account",
this.currentUser.findDetails()
);
this.send("closeModal");
} else {
this.set("model.error", result.error);
}
})
.catch(popupAjaxError);
}
}
});