使用 nuxt.js 时fetch(),每当我重新加载页面时,它都不会再次获取它。仅当我来自路由器链路时。如何强制它从我的 API 中实际重新获取?
export default {
async fetch() {
const data = await this.$axios.$get(`/users/${this.$route.params.name}`)
this.user = data
},
data() {
return {
user: []
}
}
}
Run Code Online (Sandbox Code Playgroud)
我查看的每个页面,他们总是在页面刷新时显示占位符,同时从他们的 API 重新获取,为什么我的 Nuxt.js 应用程序在刷新时不这样做?它只是没有从我的 API 重新获取数据,这很奇怪。
我收到此错误:
Argument 1 passed to Tymon\JWTAuth\JWTGuard::login() must implement interface Tymon\JWTAuth\Contracts\JWTSubject
Run Code Online (Sandbox Code Playgroud)
每当我想用我的用户登录时。
但是,我搜索了所有内容,发现的只是将其实现到用户模型中,但已经完成了,如您在此处看到的:
Argument 1 passed to Tymon\JWTAuth\JWTGuard::login() must implement interface Tymon\JWTAuth\Contracts\JWTSubject
Run Code Online (Sandbox Code Playgroud)
代币创建:
namespace App;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Auth;
class User extends Authenticatable implements JWTSubject
{
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
...
...
}
Run Code Online (Sandbox Code Playgroud)
尽管我已经像文档所说的那样更改了所有内容,为什么仍然出现此错误?