Skip to content

Commit

Permalink
fix: fix auth http client not pass storage key problem #98
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jul 5, 2023
1 parent cba8cd4 commit eec3a79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 2 additions & 3 deletions server/admin/src/client/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
ListTable,
Resource,
Tushan,
createAuthHttpClient,
} from 'tushan';
import {
IconDashboard,
Expand All @@ -19,7 +18,7 @@ import {
IconUserGroup,
IconWifi,
} from 'tushan/icon';
import { authProvider } from './auth';
import { authHTTPClient, authProvider } from './auth';
import { Dashboard } from './components/Dashboard';
import { fileFields, groupFields, mailFields, messageFields } from './fields';
import { i18n } from './i18n';
Expand All @@ -30,7 +29,7 @@ import { SocketIOAdmin } from './routes/socketio';
import { SystemConfig } from './routes/system';
import { SystemNotify } from './routes/system/notify';

const dataProvider = jsonServerProvider('/admin/api', createAuthHttpClient());
const dataProvider = jsonServerProvider('/admin/api', authHTTPClient);

function App() {
return (
Expand Down
9 changes: 8 additions & 1 deletion server/admin/src/client/auth.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { AuthProvider, createAuthProvider } from 'tushan';
import {
AuthProvider,
createAuthHttpClient,
createAuthProvider,
HTTPClient,
} from 'tushan';

export const authStorageKey = 'tailchat:admin:auth';

export const authProvider: AuthProvider = createAuthProvider({
authStorageKey,
loginUrl: '/admin/api/login',
});

export const authHTTPClient: HTTPClient = createAuthHttpClient(authStorageKey);

0 comments on commit eec3a79

Please sign in to comment.