mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-18 03:52:54 +00:00
Added login path for Spritely (#10484)
This commit is contained in:
parent
217c16988b
commit
81ffcf9c1b
1 changed files with 15 additions and 0 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue