mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Added login path for Spritely (#10484)
This commit is contained in:
@@ -85,6 +85,12 @@ export default {
|
||||
showApiToken: false,
|
||||
};
|
||||
},
|
||||
mounted () {
|
||||
window.addEventListener('message', this.receiveMessage, false);
|
||||
},
|
||||
destroy () {
|
||||
window.removeEventListener('message', this.receiveMessage);
|
||||
},
|
||||
computed: {
|
||||
...mapState({user: 'user.data', credentials: 'credentials'}),
|
||||
apiToken () {
|
||||
@@ -92,6 +98,15 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
receiveMessage (eventFrom) {
|
||||
if (event.origin !== 'https://www.spritely.app') return;
|
||||
|
||||
const creds = {
|
||||
userId: this.user._id,
|
||||
apiToken: this.credentials.API_TOKEN,
|
||||
};
|
||||
eventFrom.source.postMessage(creds, event.origin);
|
||||
},
|
||||
async addWebhook (url) {
|
||||
let webhookInfo = {
|
||||
id: uuid(),
|
||||
|
||||
Reference in New Issue
Block a user