mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Allow clearing user name and email fields through the interface
Update frontend and backend to permit empty strings for firstName, lastName, and email fields when updating user data, addressing an issue where clearing these fields was not persisted. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/vetH0Gp
This commit is contained in:
1 parent
e120b48539
commit
e887d8a11c
2 files changed
+6
-3
No files matched your search
@@ -147,7 +147,10 @@ export default function UsersPage() {
|
||||
// Nettoyer les données côté frontend avant envoi
|
||||
const cleanedUpdates = {};
|
||||
for (const [key, value] of Object.entries(data.updates)) {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
// For name fields (firstName, lastName, email), allow empty strings to clear the fields
|
||||
if (key === 'firstName' || key === 'lastName' || key === 'email') {
|
||||
cleanedUpdates[key] = value || '';
|
||||
} else if (value !== undefined && value !== null && value !== '') {
|
||||
cleanedUpdates[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -935,8 +935,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
const updateUserSchema = z.object({
|
||||
username: z.string().optional(),
|
||||
role: z.enum(['admin', 'manager', 'employee']).optional(),
|
||||
firstName: z.string().optional(),
|
||||
lastName: z.string().optional(),
|
||||
firstName: z.union([z.string(), z.literal("")]).optional(),
|
||||
lastName: z.union([z.string(), z.literal("")]).optional(),
|
||||
email: z.union([z.string().email(), z.literal("")]).optional(),
|
||||
password: z.string().optional(),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user