fix: update API endpoints in AuthRepository and RecipeRepository to remove redundant '/api' prefix
This commit is contained in:
@@ -10,7 +10,7 @@ class AuthRepository {
|
|||||||
|
|
||||||
Future<String> login(String email, String password) async {
|
Future<String> login(String email, String password) async {
|
||||||
final response = await _api.post(
|
final response = await _api.post(
|
||||||
'/api/auth/login',
|
'/auth/login',
|
||||||
jsonEncode({'email': email, 'password': password}),
|
jsonEncode({'email': email, 'password': password}),
|
||||||
);
|
);
|
||||||
if (response.statusCode != 200 && response.statusCode != 201) {
|
if (response.statusCode != 200 && response.statusCode != 201) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class RecipeRepository {
|
|||||||
RecipeRepository(this._api);
|
RecipeRepository(this._api);
|
||||||
|
|
||||||
Future<List<Recipe>> fetchRecipes({String? token}) async {
|
Future<List<Recipe>> fetchRecipes({String? token}) async {
|
||||||
final response = await _api.get('/api/recipes', token: token);
|
final response = await _api.get('/recipes', token: token);
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
throw Exception('Failed to load recipes: ${response.statusCode}');
|
throw Exception('Failed to load recipes: ${response.statusCode}');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user