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