Skip to content

Commit

Permalink
Merge pull request #76 from kookmin-sw/FE_Feature/#59-BackendConnect
Browse files Browse the repository at this point in the history
FE feature/#59 backend connect
ZombieBread123 authored May 14, 2024
2 parents 19f81b4 + d70af30 commit 5d0972b
Showing 15 changed files with 1,148 additions and 242 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions .idea/capstone-2024-39.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 39 additions & 5 deletions frontend/lib/http.dart
Original file line number Diff line number Diff line change
@@ -194,22 +194,39 @@ Future<dynamic> groupCreate(dynamic token, String name, String topic,
//컨텐츠 생성하기
Future<dynamic> contentCreate(
dynamic token,
int bookId,
int clubId,
String isbn,
String title2,
String author,
String publisher,
String publishDate,
String imageUrl,
String contentType,
String title,
String body,
String startDate,
String endDate) async {
var address =
Uri.parse("$BASE_URL/content/create?bookId=$bookId&clubId=$clubId");
var address;
if (clubId == 0) {
address = Uri.parse("$BASE_URL/content/create?");
} else {
address = Uri.parse("$BASE_URL/content/create?clubId=$clubId");
}
http.Response res = await http.post(
address,
headers: {
"Content-Type": "application/json",
"Authorization": 'Bearer $token',
},
body: json.encode({
"addBookRequest": {
"isbn": "i-$isbn",
"title": title2,
"author": author,
"publisher": publisher,
"publishDate": publishDate,
"imageUrl": imageUrl,
},
"contentType": contentType,
"title": title,
"body": body,
@@ -471,7 +488,7 @@ Future<String> commentCreate(dynamic token, int postId, String body) async {
//서재 불러오기
Future<List<dynamic>> getLibrary(String token) async {
List<dynamic> libraryList = [];
var address = Uri.parse("$BASE_URL/library");
var address = Uri.parse("$BASE_URL/member/my-book");
http.Response res = await http.get(
address,
headers: {
@@ -495,7 +512,7 @@ Future<String> addBookToLibrary(
String publisher,
String publishDate,
String imageUrl) async {
var address = Uri.parse("$BASE_URL/library/add");
var address = Uri.parse("$BASE_URL/member/my-book/add");
http.Response res = await http.post(
address,
headers: {
@@ -514,3 +531,20 @@ Future<String> addBookToLibrary(
final data = res.body;
return data;
}

//서재에 책 여러권 추가하기
Future<String> addBooksToLibrary(
String token, String groupName, List<dynamic> books) async {
var address = Uri.parse("$BASE_URL/member/my-book/adds?groupName=$groupName");
http.Response res = await http.post(
address,
headers: {
"Content-Type": "application/json",
"Authorization": 'Bearer $token',
},
body: json.encode(books),
);
final data = res.body;
print(data);
return data;
}
6 changes: 3 additions & 3 deletions frontend/lib/main.dart
Original file line number Diff line number Diff line change
@@ -192,7 +192,7 @@ final GoRouter router = GoRouter(
GoRoute(
name: 'homework_make',
path: '/homework_make',
builder: (context, state){
builder: (context, state) {
int clubId = state.extra as int;
return HomeworkMakeScreen(
clubId: clubId,
@@ -202,11 +202,11 @@ final GoRouter router = GoRouter(
GoRoute(
name: 'homeworkmember_make',
path: '/homeworkmember_make',
builder: (context, state){
builder: (context, state) {
final Map<String, dynamic> extradata =
state.extra as Map<String, dynamic>;
int clubId = extradata['clubId'] as int;
Map<String,dynamic> post = extradata['post'] as Map<String,dynamic>;
Map<String, dynamic> post = extradata['post'] as Map<String, dynamic>;
return HomeworkMemberlistScreen(
clubId: clubId,
post: post,
5 changes: 5 additions & 0 deletions frontend/lib/provider/secure_storage_provider.dart
Original file line number Diff line number Diff line change
@@ -18,6 +18,11 @@ class SecureStorageService extends ChangeNotifier {
await _secureStorage.delete(key: key);
notifyListeners();
}

Future<void> deleteAllData() async {
await _secureStorage.deleteAll();
notifyListeners();
}
}

class SecureStorageProvider extends StatelessWidget {
Loading

0 comments on commit 5d0972b

Please sign in to comment.