removed region from create

This commit is contained in:
hannathkadher
2024-11-22 00:29:35 +04:00
parent 82343e0634
commit 1a967e2ba0
5 changed files with 5 additions and 11 deletions

View File

@ -127,8 +127,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
try {
CommunityModel? newCommunity = await _api.createCommunity(
event.name,
event.description,
event.regionId,
event.description
);
if (newCommunity != null) {

View File

@ -73,16 +73,14 @@ class UpdateSpacePositionEvent extends SpaceManagementEvent {
class CreateCommunityEvent extends SpaceManagementEvent {
final String name;
final String description;
final String regionId;
const CreateCommunityEvent({
required this.name,
required this.description,
required this.regionId,
});
@override
List<Object> get props => [name, description, regionId];
List<Object> get props => [name, description];
}
class FetchProductsEvent extends SpaceManagementEvent {}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class CreateCommunityDialog extends StatefulWidget {
final Function(String name, String description, String regionId)
final Function(String name, String description)
onCreateCommunity;
const CreateCommunityDialog({super.key, required this.onCreateCommunity});
@ -114,7 +114,6 @@ class CreateCommunityDialogState extends State<CreateCommunityDialog> {
widget.onCreateCommunity(
enteredName,
"",
"42dc377a-1a39-4df9-b85a-b3817af88525",
);
Navigator.of(context).pop();
}

View File

@ -59,12 +59,11 @@ class _SidebarWidgetState extends State<SidebarWidget> {
showDialog(
context: parentContext,
builder: (context) => CreateCommunityDialog(
onCreateCommunity: (String communityName, String description, String regionId) {
onCreateCommunity: (String communityName, String description) {
parentContext.read<SpaceManagementBloc>().add(
CreateCommunityEvent(
name: communityName,
description: description,
regionId: regionId,
),
);
},

View File

@ -45,14 +45,13 @@ class CommunitySpaceManagementApi {
}
}
Future<CommunityModel?> createCommunity(String name, String description, String regionId) async {
Future<CommunityModel?> createCommunity(String name, String description) async {
try {
final response = await HTTPService().post(
path: ApiEndpoints.createCommunity,
body: {
'name': name,
'description': description,
'regionId': regionId,
},
expectedResponseModel: (json) {
return CommunityModel.fromJson(json['data']);