From 63ea56355372e9a6b071fd09af4f4c6e122522c9 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Fri, 13 Sep 2019 12:56:26 +1000 Subject: [PATCH] Set the user email initially in stripe form --- assets/javascripts/discourse/routes/patrons.js.es6 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/routes/patrons.js.es6 b/assets/javascripts/discourse/routes/patrons.js.es6 index 0cf0836..7b51761 100644 --- a/assets/javascripts/discourse/routes/patrons.js.es6 +++ b/assets/javascripts/discourse/routes/patrons.js.es6 @@ -1,9 +1,20 @@ +import { ajax } from "discourse/lib/ajax"; + export default Discourse.Route.extend({ model() { - return Ember.Object.create({ + const user = Ember.Object.create({ name: "", email: "", phone: "" }); + + return ajax("/patrons/patrons", { + method: "get" + }).then((result) => { + user.set('email', result.email) + return user; + }).catch(() => { + return user; + }); } });