mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Added login path for Spritely (#10484)
This commit is contained in:
@@ -85,6 +85,12 @@ export default {
|
|||||||
showApiToken: false,
|
showApiToken: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
window.addEventListener('message', this.receiveMessage, false);
|
||||||
|
},
|
||||||
|
destroy () {
|
||||||
|
window.removeEventListener('message', this.receiveMessage);
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({user: 'user.data', credentials: 'credentials'}),
|
...mapState({user: 'user.data', credentials: 'credentials'}),
|
||||||
apiToken () {
|
apiToken () {
|
||||||
@@ -92,6 +98,15 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
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) {
|
async addWebhook (url) {
|
||||||
let webhookInfo = {
|
let webhookInfo = {
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
|
|||||||
Reference in New Issue
Block a user