Skip to content

Commit

Permalink
Merge pull request #54 from 2024-Saphy/feat/SAPHY-34-product-detail-page
Browse files Browse the repository at this point in the history
[FEAT] : favorite product 관련 기능 완성
  • Loading branch information
cho4u4o authored Oct 19, 2024
2 parents c2298f0 + fe7ec52 commit 320c613
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 220 deletions.
20 changes: 9 additions & 11 deletions lib/screens/products/liked_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import 'package:flutter/widgets.dart';
// import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:intl/intl.dart';
import 'package:saphy/models/product.dart';
import 'package:saphy/service/api_service.dart';
import 'package:saphy/service/authentication/secure_storage.dart';
import 'package:saphy/utils/textstyles.dart';
import 'package:saphy/widgets/product_card.dart';
import 'package:saphy/utils/colors.dart';
import 'package:saphy/widgets/app_bar.dart';
import 'package:dio/dio.dart';

class LikedListPage extends StatefulWidget {
const LikedListPage({super.key});
Expand All @@ -23,18 +22,17 @@ class _LikedListPageState extends State<LikedListPage> {
int cnt = 0;

Future<List<Product>> getProducts() async {
final dio = Dio();
String? accessToken = await readAccessToken();
String token = await readJwt();
token = token.toString().split(" ")[2];

try {
final response = await dio.get(
'https://saphy.site/item-wishes/',
options: Options(
headers: {
'Authorization': 'Bearer $accessToken', // 필요한 헤더 추가
},
),
final response = await APIService.instance.request(
'https://saphy.site/item-wishes?type=ALL',
DioMethod.get,
contentType: 'application/json',
token: "Bearer $token",
);

if (response.statusCode == 200) {
final data = response.data as Map<String, dynamic>;
if (data['results'] != null) {
Expand Down
Loading

0 comments on commit 320c613

Please sign in to comment.