Update .env to set the API base URL for production environment, and refactor MultiselectPaginatedSelect component by removing unused display text logic. Enhance Roles page by updating role creation and update handlers to use new type definitions for improved type safety.
This commit is contained in:
parent
9a0d28145a
commit
0264d5caf5
4
.env
4
.env
@ -1,2 +1,2 @@
|
||||
VITE_API_BASE_URL=http://localhost:3000/api/v1
|
||||
# VITE_API_BASE_URL=https://backendqaasure.tech4bizsolutions.com/api/v1
|
||||
# VITE_API_BASE_URL=http://localhost:3000/api/v1
|
||||
VITE_API_BASE_URL=https://backendqaasure.tech4bizsolutions.com/api/v1
|
||||
|
||||
@ -195,15 +195,6 @@ export const MultiselectPaginatedSelect = ({
|
||||
onValueChange(value.filter((v) => v !== optionValue));
|
||||
};
|
||||
|
||||
const getDisplayText = (): string => {
|
||||
if (value.length === 0) return placeholder;
|
||||
if (value.length === 1) {
|
||||
const option = options.find((opt) => opt.value === value[0]);
|
||||
return option ? option.label : `${value.length} selected`;
|
||||
}
|
||||
return `${value.length} selected`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2 pb-4">
|
||||
<label
|
||||
|
||||
@ -16,7 +16,7 @@ import {
|
||||
} from '@/components/shared';
|
||||
import { Plus, Download, ArrowUpDown } from 'lucide-react';
|
||||
import { roleService } from '@/services/role-service';
|
||||
import type { Role } from '@/types/role';
|
||||
import type { Role, CreateRoleRequest, UpdateRoleRequest } from '@/types/role';
|
||||
import { showToast } from '@/utils/toast';
|
||||
|
||||
// Helper function to format date
|
||||
@ -103,12 +103,7 @@ const Roles = (): ReactElement => {
|
||||
fetchRoles(currentPage, limit, scopeFilter, orderBy);
|
||||
}, [currentPage, limit, scopeFilter, orderBy]);
|
||||
|
||||
const handleCreateRole = async (data: {
|
||||
name: string;
|
||||
code: string;
|
||||
description: string;
|
||||
scope: 'platform' | 'tenant' | 'module';
|
||||
}): Promise<void> => {
|
||||
const handleCreateRole = async (data: CreateRoleRequest): Promise<void> => {
|
||||
try {
|
||||
setIsCreating(true);
|
||||
const response = await roleService.create(data);
|
||||
@ -140,12 +135,7 @@ const Roles = (): ReactElement => {
|
||||
// Update role handler
|
||||
const handleUpdateRole = async (
|
||||
id: string,
|
||||
data: {
|
||||
name: string;
|
||||
code: string;
|
||||
description: string;
|
||||
scope: 'platform' | 'tenant' | 'module';
|
||||
}
|
||||
data: UpdateRoleRequest
|
||||
): Promise<void> => {
|
||||
try {
|
||||
setIsUpdating(true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user