24 lines
752 B
TypeScript
24 lines
752 B
TypeScript
import querystring from 'querystring'
|
|
import { Vue, Component } from "nuxt-property-decorator";
|
|
import { initLIFF } from "~/plugins/liff";
|
|
|
|
const ENDPOINT = 'https://api.contree.io/profile'
|
|
|
|
export default {
|
|
async middleware({ req, res, error, $axios, redirect }) {
|
|
const url: URL = new URL(req.url, `https://${req.headers.host}`)
|
|
const uid: string = url.searchParams.get('LINEUserID') || ''
|
|
//const veify_checked = url.searchParams.get('Veify_Checked')
|
|
//console.log(veify_checked)
|
|
console.log(uid)
|
|
|
|
|
|
|
|
const response = await $axios.get(ENDPOINT, {
|
|
params: { LINEUserID: uid }
|
|
})
|
|
await res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
|
res.end(JSON.stringify(response.data.slice(-1)))
|
|
}
|
|
}
|