0

当我使用 nuxt auth 登录时,我将用户重定向到他的个人资料页面。但是在个人资料页面上重新加载后,我收到一个类似截图的错误:

在此处输入图像描述

我已经搜索了与@nuxtjs/auth-next ssr 问题相关的这个问题。大多数解决方案是降级@nuxtjs/axios 版本。我已经尝试过了,但没有修复。

这是我的个人资料页面代码:

<template>
    <div v-show="$auth.user">
        <!-- profile image -->
        <div class="w-full flex">
            <div>
                <div class="bg-gray-200 p-5 w-40 h-44"></div>
            </div>
            <div class="ml-6">
                <h2 class="font-bold text-2xl mb-4">Profile Details</h2>
                <h6 class="font-semibold text-lg">{{$auth.user.name}}</h6>
                <p><span class="font-medium">Email: </span>{{$auth.user.email}}</p>
                <p><span class="font-medium">Phone: </span>{{$auth.user.phone}}</p>
                <p><span class="font-medium">Last Login: </span>{{$auth.user.lastLoginForHuman}}</p>
                <nuxt-link to="/customer/change-password" class="block mt-3 text-primary-500 text-sm hover:underline">Change Password</nuxt-link>
            </div>

        </div>

        <!-- details -->
        <div class="w-full mt-5">
            <div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
                <input-field label="First name"></input-field>
                <input-field label="Last name"></input-field>
                <input-field type="email" label="Email"></input-field>
                <input-field label="Phone"></input-field>
            </div>

            <div class="flex justify-end">
                <button-field label="Update" class="bg-primary-500 text-white py-3 px-10"></button-field>
            </div>
        </div>

    </div>
</template>

<script>
export default {
    name: "Profile",
    data() {
        return {
            form: {
                firstName: this.$auth.user?.firstName,
                lastName: this.$auth.user?.lastName,
                email: this.$auth.user?.email,
                phone: this.$auth.user?.phone,
            },
            photo: null,
        };
    },
};
</script>

“@nuxtjs/auth-next”:“^5.0.0-1624817847.21691f1”,“@nuxtjs/axios”:“^5.13.6”,“nuxt”:“^2.15.7”

4

0 回答 0