fix(registration) Finished fixing registration after code refactoring

This commit is contained in:
2024-03-14 16:24:33 +03:00
parent e4637d54e8
commit 4a5fa3dd5c
4 changed files with 19 additions and 14 deletions

4
.env
View File

@@ -1,2 +1,2 @@
SERVER_ROOT='https://ohngeeri3ien-dev3.eatvio.ru/api' SERVER_ROOT='https://mobile-stage.eatvio.ru/api'
STORAGE_URL='https://ohngeeri3ien-dev3.eatvio.ru/storage/' STORAGE_URL='https://mobile-stage.eatvio.ru/storage/'

View File

@@ -77,7 +77,7 @@ class AuthScreen extends StatelessWidget {
margin: margin:
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15, buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapAuth(state, context)); onPressed: () => onTapAuth(state, context));
}), }),
]))); ])));
} }

View File

@@ -76,19 +76,24 @@ class AdditionalInformationScreen extends StatelessWidget {
UserRegistrationSheet sheet = UserRegistrationSheet sheet =
state.additionalInformationModelObj!.userRegistrationSheet; state.additionalInformationModelObj!.userRegistrationSheet;
sheet.additionalInfo = state.editTextController!.text; sheet.additionalInfo = state.editTextController!.text;
//print(json.encode(sheet.toJson()));
final response = await http.post( final response = await http.post(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'), Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'),
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},
body: json.encode(sheet), body: jsonEncode(sheet.toJson()),
);
var res = await jsonDecode(response.body);
final box = await Hive.openBox('token');
final token = res['token'];
box.put('token', token);
Navigator.pushNamed(
context,
AppRoutes.myProfile,
); );
print(response.statusCode);
print(response.body);
if (response.statusCode == 200) {
var res = await jsonDecode(response.body);
final box = await Hive.openBox('token');
final token = res['token'];
box.put('token', token);
Navigator.pushNamed(
context,
AppRoutes.myProfile,
);
}
}; };
} }

View File

@@ -38,7 +38,7 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
body: Container( body: Container(
width: double.maxFinite, width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
child: ListView(children: [ child: Column(children: [
SizedBox(height: 7.v), SizedBox(height: 7.v),
Container( Container(
height: 16.v, height: 16.v,
@@ -68,7 +68,7 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
_buildTextFormFieldFav(context), _buildTextFormFieldFav(context),
SizedBox(height: 12.v), SizedBox(height: 12.v),
_buildTextFormFieldUnfav(context), _buildTextFormFieldUnfav(context),
SizedBox(height: 17.v), Spacer(),
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>( BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(
builder: (context, state) { builder: (context, state) {
return NextStepButton( return NextStepButton(