如何解决Nuxt中的帐户激活
如何使Nuxt页面对特定URL执行POST,以便根据页面URL中的参数激活帐户?
例如,如果用户单击电子邮件中的链接,例如:-
https://example.com/activate/MQ/abcdef/
我希望该页面将“ MQ”和“ abcdef”作为数据发送到/ users / activation /,并在响应正常的情况下将用户重定向到网站的登录页面。
解决方法
您可以创建一个名为回调的页面
// callback.vue
<template>
<div>
<loading />
</div>
</template>
<script>
import loading from '~/components/common/loading';
export default {
components: {
loading
},mounted() {
this.login();
},methods: {
login() {
let data = {
YOUR_PARAMS
};
this.$axios
.$post(`YOUR_URL`,data)
.then(res => {
if (YOUR_CONDITIONS) {
this.$router.push({ path: '/LINK_A' });
else
this.$router.push({ path: '/LINK_B' });
}
});
}
}
};
</script>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。