mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 02:25:16 +00:00
added client token login
This commit is contained in:
@ -48,13 +48,26 @@ class HTTPService {
|
||||
Options? options,
|
||||
dynamic body,
|
||||
bool showServerMessage = true,
|
||||
String? accessToken,
|
||||
required T Function(dynamic) expectedResponseModel}) async {
|
||||
try {
|
||||
final authOptions = options ??
|
||||
Options(
|
||||
headers: accessToken != null
|
||||
? {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
final response = await client.post(
|
||||
path,
|
||||
data: body,
|
||||
queryParameters: queryParameters,
|
||||
options: options,
|
||||
options: authOptions,
|
||||
);
|
||||
return expectedResponseModel(response.data);
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user