mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
removed region from create
This commit is contained in:
@ -127,8 +127,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
|
|||||||
try {
|
try {
|
||||||
CommunityModel? newCommunity = await _api.createCommunity(
|
CommunityModel? newCommunity = await _api.createCommunity(
|
||||||
event.name,
|
event.name,
|
||||||
event.description,
|
event.description
|
||||||
event.regionId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newCommunity != null) {
|
if (newCommunity != null) {
|
||||||
|
@ -73,16 +73,14 @@ class UpdateSpacePositionEvent extends SpaceManagementEvent {
|
|||||||
class CreateCommunityEvent extends SpaceManagementEvent {
|
class CreateCommunityEvent extends SpaceManagementEvent {
|
||||||
final String name;
|
final String name;
|
||||||
final String description;
|
final String description;
|
||||||
final String regionId;
|
|
||||||
|
|
||||||
const CreateCommunityEvent({
|
const CreateCommunityEvent({
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.description,
|
required this.description,
|
||||||
required this.regionId,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [name, description, regionId];
|
List<Object> get props => [name, description];
|
||||||
}
|
}
|
||||||
|
|
||||||
class FetchProductsEvent extends SpaceManagementEvent {}
|
class FetchProductsEvent extends SpaceManagementEvent {}
|
||||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
class CreateCommunityDialog extends StatefulWidget {
|
class CreateCommunityDialog extends StatefulWidget {
|
||||||
final Function(String name, String description, String regionId)
|
final Function(String name, String description)
|
||||||
onCreateCommunity;
|
onCreateCommunity;
|
||||||
|
|
||||||
const CreateCommunityDialog({super.key, required this.onCreateCommunity});
|
const CreateCommunityDialog({super.key, required this.onCreateCommunity});
|
||||||
@ -114,7 +114,6 @@ class CreateCommunityDialogState extends State<CreateCommunityDialog> {
|
|||||||
widget.onCreateCommunity(
|
widget.onCreateCommunity(
|
||||||
enteredName,
|
enteredName,
|
||||||
"",
|
"",
|
||||||
"42dc377a-1a39-4df9-b85a-b3817af88525",
|
|
||||||
);
|
);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,11 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
showDialog(
|
showDialog(
|
||||||
context: parentContext,
|
context: parentContext,
|
||||||
builder: (context) => CreateCommunityDialog(
|
builder: (context) => CreateCommunityDialog(
|
||||||
onCreateCommunity: (String communityName, String description, String regionId) {
|
onCreateCommunity: (String communityName, String description) {
|
||||||
parentContext.read<SpaceManagementBloc>().add(
|
parentContext.read<SpaceManagementBloc>().add(
|
||||||
CreateCommunityEvent(
|
CreateCommunityEvent(
|
||||||
name: communityName,
|
name: communityName,
|
||||||
description: description,
|
description: description,
|
||||||
regionId: regionId,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -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 {
|
try {
|
||||||
final response = await HTTPService().post(
|
final response = await HTTPService().post(
|
||||||
path: ApiEndpoints.createCommunity,
|
path: ApiEndpoints.createCommunity,
|
||||||
body: {
|
body: {
|
||||||
'name': name,
|
'name': name,
|
||||||
'description': description,
|
'description': description,
|
||||||
'regionId': regionId,
|
|
||||||
},
|
},
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return CommunityModel.fromJson(json['data']);
|
return CommunityModel.fromJson(json['data']);
|
||||||
|
Reference in New Issue
Block a user