Created
July 21, 2021 17:03
-
-
Save nickfogle/fc2ffeb83b006356a662488d1e1041d6 to your computer and use it in GitHub Desktop.
Churnkey vue.js sample template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<h1>Click to launch Churnkey</h1> | |
<!-- show button if user can cancel and loading finished --> | |
<div> | |
<button id="ck-cancel" @click="cancelFlow()" v-if="user.canCancel && !isLoading">Cancel</el-button> | |
</div> | |
</template> | |
<script> | |
import loadChurnKey from '@/helpers/loadChurnKey'; | |
import launchChurnKey from '@/helpers/launchChurnKey'; | |
export default { | |
name: 'SamplePage', | |
computed: { | |
user() { | |
return this.$store.state.user; | |
}, | |
canCancel() { | |
// hide cancel button if user doesn't have an active subscription | |
return this.user.subscription; | |
}, | |
}, | |
data() { | |
return { | |
isLoading: false, | |
}; | |
}, | |
methods: { | |
// click handler for launching churnkey embed | |
cancelFlow() { | |
launchChurnKey(this.user); | |
}, | |
}, | |
mounted() { | |
const vm = this; | |
loadChurnKey(); | |
}, | |
}; | |
</script> | |
<style> | |
.button { | |
color: #000; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment