0
ページリロード時にAPI呼び出しのJWTトークンがリロードされない。 Dashboardパスの再ロードは正常に機能しますが、リソースパスでは失敗します。リソースパスのページを更新するとアプリがログアウトする
私はfeathers-clientを設定する方法を理解していません。
`` ``
//feathersClient.js
import feathers from 'feathers-client';
const host = 'http://localhost:3030';
export default feathers()
.configure(feathers.hooks())
.configure(feathers.rest(host).fetch(window.fetch.bind(window)))
.configure(feathers.authentication({ jwtStrategy: 'jwt', storage: window.localStorage }));
//authClient.js
import { authClient } from 'aor-feathers-client';
import feathersClient from './ApiClient/feathersClient';
const authClientOptions = {
storageKey: 'feathers-jwt',
authenticate: { strategy: 'local' },
};
export default authClient(feathersClient, authClientOptions)
//App.js
import React from 'react';
import { Admin, Resource } from 'admin-on-rest';
import { Delete } from 'admin-on-rest/lib/mui'
import apiClient from './ApiClient'
import authClient from './authClient'
import Dashboard from './components/Dashboard'
import { ProjectList, ProjectCreate, ProjectShow, ProjectEdit } from './components/Projects'
import { PeopleList, PeopleCreate, PeopleShow, PeopleEdit } from './components/Peoples'
const App =() => (
<Admin
authClient={authClient}
restClient={apiClient}
title="SWP by Akoya"
dashboard={Dashboard}>
<Resource name="projects"
list={ProjectList}
create={ProjectCreate}
show={ProjectShow}
edit={ProjectEdit}
remove={Delete}/>
</Admin>
)
export default App
、これはおそらく、取り扱いの際に' AOR-羽-client'パッケージの 'authClient'が認証を呼び出す必要があることを意味'AUTH_CHECK'タイプ – Gildas
実際には、admin-on-restをfeathers api:https://github.com/josx/aor-feathers-client/issues/39に接続するために使用するlibに関連していました。どうも – Fonzarely