Skip to content

Commit

Permalink
fix(#59): corrige autorização da api
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCostaDeOliveira committed Jan 11, 2025
1 parent 2d5746a commit ad09af6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 50 deletions.
2 changes: 1 addition & 1 deletion lib/core/network/app_interceptors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppInterceptors extends Interceptor {
Log.w(token);

if (token != null) {
options.headers['Authorization'] = token;
options.headers['Authorization'] = 'Bearer $token';
} else {
Log.w('Token não encontrado');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/edit_password/service/edit_password_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class EditPasswordService {

static Future<void> edit(EditPasswordRequest editPasswordRequest) async {
await BaseApi.getInstance(auth: true)
.put(path: '/outh-change-password', data: editPasswordRequest.toJson());
.put(path: '/auth/change-password', data: editPasswordRequest.toJson());
}


Expand Down
3 changes: 1 addition & 2 deletions lib/ui/edit_profile/view/edit_profile_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:aranduapp/ui/edit_profile/viewmodel/edit_profile_viewmodel.dart';
import 'package:aranduapp/ui/shared/TextEmail.dart';
import 'package:aranduapp/ui/shared/ProfileHeader.dart';
import 'package:aranduapp/ui/shared/TextName.dart';
import 'package:aranduapp/ui/shared/requestbutton.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -105,7 +104,7 @@ class EditProfileScreen extends StatelessWidget {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
'Estamos quase lá! Confira seu e-mail para redefinir sua senha.')),
'Usuario atualizado com sucesso. ')),
);
});
}
Expand Down
83 changes: 37 additions & 46 deletions lib/ui/profile/view/ProfileView.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,7 @@ class Profile extends StatelessWidget {
children: [
_buildProfileHeader(context),
const SizedBox(height: 80),
SizedBox(
width: double.infinity,
height: 60,
child: Card(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const EditPassword(),
),
);
},
child: Row(
children: [
Icon(
Icons.lock_reset,
color: Theme.of(context).colorScheme.primary,
size: 32,
),
const Text('Trocar senha'),
Icon(
Icons.chevron_right,
color: Theme.of(context).colorScheme.primary,
size: 32,
),
],
),
)
],
),
),
),
const SizedBox(height: 80),
_buildLogoutButton(context),
_setting(context),
],
),
),
Expand Down Expand Up @@ -139,14 +102,42 @@ class Profile extends StatelessWidget {
);
}

/// Botão Deslogar
Widget _buildLogoutButton(BuildContext context) {
return SizedBox(
width: 291,
height: 64,
child: ElevatedButton(
onPressed: () => {},
child: const Text('Deslogar'),

Widget _setting(BuildContext context) {
return Card(
child: Column(
children: [
ListTile(
leading: Icon(
Icons.lock_reset,
color: Theme.of(context).colorScheme.primary,
size: 32,
),
title: const Text('Trocar senha'),
trailing: Icon(
Icons.chevron_right,
color: Theme.of(context).colorScheme.primary,
size: 32,
),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const EditPassword(),
),
);
},
),
const Divider(),
ListTile(
leading: Icon(
Icons.logout_sharp,
color: Theme.of(context).colorScheme.error,
size: 32,
),
title: const Text('Sair'),
onTap: () {},
),
],
),
);
}
Expand Down

0 comments on commit ad09af6

Please sign in to comment.