scrapeAndStoreProfileUrl static method
Returns true only when backend responds 2xx.
Implementation
static Future<bool> scrapeAndStoreProfileUrl({required String profileUrl}) async {
final userId = await _deriveUserId();
if (userId == null || userId.isEmpty) return false;
final storage = EnhancedSecureStorageService();
final jwt = await storage.getStoredJwtToken();
final body = jsonEncode({
'userId': userId,
'profileUrl': profileUrl,
});
final headers = <String, String>{
'Content-Type': 'application/json',
'X-Onairos-Client': 'flutter-linkedin-apify',
if (jwt != null && jwt.isNotEmpty) 'Authorization': 'Bearer $jwt',
};
final res = await http
.post(Uri.parse(_endpoint), headers: headers, body: body)
.timeout(_timeout);
return res.statusCode >= 200 && res.statusCode < 300;
}