Skip to content

Commit eaa5c17

Browse files
author
saikou
committed
add story page added api
1 parent 0d06907 commit eaa5c17

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

ios/Runner/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

lib/ServiceItems/network_service.dart

+33-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class NetworkService {
3939
_dio.options.headers["accept"] = "application/json";
4040
}
4141

42-
final String baseUrl = "https://nikahtime.ru/api"; // story didn`t use socket i think i will work with dev api
42+
final String baseUrl = "https://dev.nikahtime.ru/api"; // story didn`t use socket i think i will work with dev api
4343
//LOGIN
4444
final String login = "/login";
4545
//REGISTRATION
@@ -360,6 +360,19 @@ class NetworkService {
360360
return response;
361361
}
362362

363+
364+
StoryStore(String accessToken,String content,String type) async {
365+
Map<String, String> headers = {
366+
"Accept": "application/json",
367+
"Authorization": "Bearer $accessToken",
368+
"Content-Type": "multipart/form-data"
369+
};
370+
var response= await http.post(Uri.parse("${NetworkService().baseUrl}/story/store"),
371+
body: {"type": type, "content": content, },headers: headers);
372+
return response;
373+
374+
}
375+
363376
UpdateuserInfo(String accessToken, Object? body) async {
364377
print(body);
365378

@@ -394,6 +407,25 @@ class NetworkService {
394407
var response = await request.send();
395408
return response;
396409
}
410+
UploadFileRequestStroy(
411+
String accessToken, String imagePath, String fileType) async {
412+
Map<String, String> headers = {
413+
"Accept": "application/json",
414+
"Authorization": "Bearer $accessToken",
415+
"Content-Type": "multipart/form-data"
416+
};
417+
var request = http.MultipartRequest(
418+
"POST", Uri.parse("${NetworkService().baseUrl}/storeStory/file"));
419+
request.files.add(await http.MultipartFile.fromPath('file', imagePath));
420+
request.fields['file'] = imagePath;
421+
request.fields['fileType'] = fileType;
422+
request.headers.addAll(headers);
423+
print(request.fields);
424+
var response = await request.send();
425+
return response;
426+
}
427+
428+
397429

398430
Future<void> blockUser({required int userId}) async {
399431
SharedPreferences prefs = await SharedPreferences.getInstance();

0 commit comments

Comments
 (0)