mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
profile page with HomeCubit
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||
import 'package:syncrow_app/features/menu/bloc/profile_bloc/region_model.dart';
|
||||
import 'package:syncrow_app/features/menu/bloc/profile_bloc/time_zone_model.dart';
|
||||
@ -12,7 +12,7 @@ class ProfileApi {
|
||||
static Future<Map<String, dynamic>> saveName({String? firstName, String? lastName,}) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.saveName.replaceAll('{userUuid}', AuthCubit.user!.uuid!),
|
||||
path: ApiEndpoints.saveName.replaceAll('{userUuid}', HomeCubit.user!.uuid!),
|
||||
body: {
|
||||
"firstName": firstName,
|
||||
"lastName": lastName
|
||||
@ -30,7 +30,7 @@ class ProfileApi {
|
||||
static Future saveRegion({String? regionUuid,}) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.saveRegion.replaceAll('{userUuid}', AuthCubit.user!.uuid!),
|
||||
path: ApiEndpoints.saveRegion.replaceAll('{userUuid}', HomeCubit.user!.uuid!),
|
||||
body: {
|
||||
"regionUuid": regionUuid,
|
||||
},
|
||||
@ -46,7 +46,7 @@ class ProfileApi {
|
||||
static Future saveTimeZone({String? regionUuid,}) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.saveTimeZone.replaceAll('{userUuid}', AuthCubit.user!.uuid!),
|
||||
path: ApiEndpoints.saveTimeZone.replaceAll('{userUuid}', HomeCubit.user!.uuid!),
|
||||
body: {
|
||||
"timezoneUuid": regionUuid,
|
||||
},
|
||||
@ -63,7 +63,7 @@ class ProfileApi {
|
||||
static Future<Map<String, dynamic>> saveImage(String image) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.sendPicture.replaceAll('{userUuid}', AuthCubit.user!.uuid!),
|
||||
path: ApiEndpoints.sendPicture.replaceAll('{userUuid}', HomeCubit.user!.uuid!),
|
||||
body: {
|
||||
"profilePicture": 'data:image/png;base64,$image'
|
||||
},
|
||||
@ -77,11 +77,13 @@ class ProfileApi {
|
||||
}
|
||||
}
|
||||
|
||||
static Future fetchUserInfo(userId) async {
|
||||
Future fetchUserInfo(userId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getUser.replaceAll('{userUuid}', userId!),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) =>UserModel.fromJson(json)
|
||||
expectedResponseModel: (json) {
|
||||
return UserModel.fromJson(json);
|
||||
}
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
Reference in New Issue
Block a user