feat: add admin user management features and update user repository methods
- Implemented updateRoles, updateSanctions, and deleteUser methods in both in-memory and PostgreSQL user repositories. - Enhanced UserSanctions and UserServerRestriction interfaces to include additional properties. - Added AdminView component for admin functionalities including user lookup, role management, sanctions application, and profile management. - Integrated admin token handling in TRPC client for secure API requests. - Updated routing to include admin dashboard and linked it in the default layout.
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
|
||||
import type { AppRouter } from '../../../gateway-api/src/router';
|
||||
|
||||
const getAdminToken = (): string | null => {
|
||||
if (typeof window === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
return window.localStorage.getItem('sammo-admin-token');
|
||||
};
|
||||
|
||||
export const trpc = createTRPCProxyClient<AppRouter>({
|
||||
links: [
|
||||
httpBatchLink({
|
||||
url: '/api/trpc', // 실제 환경에 맞게 조정 필요
|
||||
headers() {
|
||||
const token = getAdminToken();
|
||||
return token ? { 'x-admin-token': token } : {};
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user