Base62 with Vue and axios
Encodes and decodes using external API call with Vue.js and axios()
by kurin
HTML
<script src="https://unpkg.com/[email protected]/dist/axios.min.js"></script>
<div id="app">
<input v-model="token" style="width:100%;height:30px;" /><br/>
<button @click="send">
send
</button>
<p v-html="log"></p>
</div>
JavaScript
/* http://base62.net/ */
var app = new Vue({
el: "#app",
data: {
headers: {
"Content-Type": "application/json",
"authorization": "key=AAAAVcpYPoM:APA91bEjwAedyCAkyiotO6NAYs8KXnBD5jVyH0i6yt--MgmrWXTmkjsm9_FpY2KkMWJ-lnb3t8Kdr1s5PlIiyYtgzeTPoRdvTYxVUNqNIm7Ms6ILt2ISJ0Dq2r9D11i5bSlwPC4lR6cU"
},
token: "e7rd0O_C9Lo:APA91bGY7SqL_3oGnkke7byyun8O8ddYNsSSHcKpRpyi9nd4LbX2yazOZ3Oyiz1QqGpAFsiaFNgcWlQ5LVR4kKV-9PFBgerf3wZiTd6YCL5MMJhz54SS7W8vL39a1E3zNf0n_lp_Nwyx",
log: ""
},
methods:{
send(){
var self = this
axios
.request({
url: "https://fcm.googleapis.com/fcm/send",
method: "post",
headers: this.headers,
data: {
/*
// 一般通知は「notification」が必要ですが、
// Voipな特殊の通信はいらないです。
"notification": {
"title": "this is a title",
"body": "great wall"
},
*/
"data":{
"title": "",
"force-start": "1", // 必ず必要なパラメータ
"body" : "",
"content-available": "1",
"receive": "{'from':{'userCd':'xxx'}}",
/*
"from" : {
"userCd": "eb098a4e-f9a0-4bga36-bb93-1ma4dtsu63na6469a",
"token": "111222333",
"type": "iOS",
"videoid": "12345670"
},
*/
"fromUser" : {
"userCd": "f49ed84e-d922-433b-8267-22cce6f1ff9a",
"token": "111222333",
"type": "iOS",
"videoid": "12345670"
},
"toUser": {
"userCd": "eb098a4e-f9a0-4bga36-bb93-1ma4dtsu63na6469a",
"token": "22334455",
"type": ""
},
...