Fix jwt-token
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import api from '../services/api'
|
||||
import toast from 'react-hot-toast'
|
||||
import { t } from '../utils/tempTranslations' // Temporary translation system
|
||||
import {
|
||||
CogIcon,
|
||||
ServerIcon,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import api from '../services/api'
|
||||
import toast from 'react-hot-toast'
|
||||
import { t } from '../utils/tempTranslations' // Temporary translation system
|
||||
import { UsersIcon, MagnifyingGlassIcon } from '@heroicons/react/24/outline'
|
||||
|
||||
const Users = () => {
|
||||
@@ -18,7 +19,7 @@ const Users = () => {
|
||||
const response = await api.get('/management/users')
|
||||
setUsers(response.data.data || [])
|
||||
} catch (error) {
|
||||
toast.error('Failed to load users')
|
||||
toast.error(t('users.loadError'))
|
||||
console.error('Error loading users:', error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
@@ -55,8 +56,8 @@ const Users = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="mb-8">
|
||||
<h1 className="text-2xl font-bold text-gray-900">Users</h1>
|
||||
<p className="text-gray-600">Manage user accounts across all tenants</p>
|
||||
<h1 className="text-2xl font-bold text-gray-900">{t('users.title')}</h1>
|
||||
<p className="text-gray-600">{t('users.description')}</p>
|
||||
</div>
|
||||
|
||||
<div className="mb-6">
|
||||
@@ -64,7 +65,7 @@ const Users = () => {
|
||||
<MagnifyingGlassIcon className="absolute left-3 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-400" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search users..."
|
||||
placeholder={t('users.searchPlaceholder')}
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
className="pl-10 pr-4 py-2 border border-gray-300 rounded-lg w-full max-w-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
|
||||
@@ -77,19 +78,19 @@ const Users = () => {
|
||||
<thead className="bg-gray-50">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
User
|
||||
{t('users.user')}
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Role
|
||||
{t('users.role')}
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Status
|
||||
{t('users.status')}
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Last Login
|
||||
{t('users.lastLogin')}
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Created
|
||||
{t('users.created')}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -135,9 +136,9 @@ const Users = () => {
|
||||
{filteredUsers.length === 0 && (
|
||||
<div className="text-center py-12">
|
||||
<UsersIcon className="mx-auto h-12 w-12 text-gray-400" />
|
||||
<h3 className="mt-2 text-sm font-medium text-gray-900">No users found</h3>
|
||||
<h3 className="mt-2 text-sm font-medium text-gray-900">{t('users.noUsers')}</h3>
|
||||
<p className="mt-1 text-sm text-gray-500">
|
||||
{searchTerm ? 'Try adjusting your search criteria.' : 'No users have been created yet.'}
|
||||
{searchTerm ? t('users.noUsersSearch') : t('users.noUsersDescription')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -59,11 +59,16 @@ const translations = {
|
||||
activeTenants: 'Active Tenants'
|
||||
},
|
||||
users: {
|
||||
title: 'User Management',
|
||||
title: 'Users',
|
||||
description: 'Manage user accounts across all tenants',
|
||||
noUsers: 'No users found',
|
||||
noUsersDescription: 'No users have been created yet.',
|
||||
noUsersSearch: 'Try adjusting your search criteria.',
|
||||
addUser: 'Add User',
|
||||
editUser: 'Edit User',
|
||||
deleteUser: 'Delete User',
|
||||
searchPlaceholder: 'Search users...',
|
||||
user: 'User',
|
||||
username: 'Username',
|
||||
email: 'Email',
|
||||
role: 'Role',
|
||||
@@ -71,7 +76,8 @@ const translations = {
|
||||
status: 'Status',
|
||||
lastLogin: 'Last Login',
|
||||
created: 'Created',
|
||||
actions: 'Actions'
|
||||
actions: 'Actions',
|
||||
loadError: 'Failed to load users'
|
||||
},
|
||||
dashboard: {
|
||||
title: 'Dashboard',
|
||||
@@ -181,11 +187,16 @@ const translations = {
|
||||
activeTenants: 'Aktiva hyresgäster'
|
||||
},
|
||||
users: {
|
||||
title: 'Användarhantering',
|
||||
title: 'Användare',
|
||||
description: 'Hantera användarkonton över alla hyresgäster',
|
||||
noUsers: 'Inga användare hittades',
|
||||
noUsersDescription: 'Inga användare har skapats ännu.',
|
||||
noUsersSearch: 'Prova att justera dina sökkriterier.',
|
||||
addUser: 'Lägg till användare',
|
||||
editUser: 'Redigera användare',
|
||||
deleteUser: 'Ta bort användare',
|
||||
searchPlaceholder: 'Sök användare...',
|
||||
user: 'Användare',
|
||||
username: 'Användarnamn',
|
||||
email: 'E-post',
|
||||
role: 'Roll',
|
||||
@@ -193,7 +204,8 @@ const translations = {
|
||||
status: 'Status',
|
||||
lastLogin: 'Senaste inloggning',
|
||||
created: 'Skapad',
|
||||
actions: 'Åtgärder'
|
||||
actions: 'Åtgärder',
|
||||
loadError: 'Misslyckades att ladda användare'
|
||||
},
|
||||
dashboard: {
|
||||
title: 'Instrumentpanel',
|
||||
|
||||
Reference in New Issue
Block a user