Skip to content

Commit c3b213e

Browse files
committed
auth debug
1 parent cea3ae1 commit c3b213e

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

lib/api_client.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ class ApiClient {
4848
Future<Map<String, dynamic>> getPowersyncToken() async {
4949
final prefs = await SharedPreferences.getInstance();
5050
final apiData = json.decode(prefs.getString(PREFS_USER)!);
51-
51+
print('posting our token "${apiData["token"]}" to $baseUrl/api/v2/powersync-token');
5252
final response = await http.get(
5353
Uri.parse('$baseUrl/api/v2/powersync-token'),
5454
headers: {
5555
HttpHeaders.contentTypeHeader: 'application/json',
5656
HttpHeaders.authorizationHeader: 'Token ${apiData["token"]}',
5757
},
5858
);
59+
print('response: status ${response.statusCode}, body ${response.body}');
5960
if (response.statusCode == 200) {
6061
log.log(Level.ALL, response.body);
6162
return json.decode(response.body);

lib/app_config.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class AppConfig {
2-
static const String djangoUrl = 'http://10.0.2.2:8000';
3-
static const String powersyncUrl = 'http://10.0.2.2:8080';
2+
static const String djangoUrl = 'http://192.168.1.195:8000';
3+
static const String powersyncUrl = 'http://192.168.1.195:8080';
44
}

lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void main() async {
8484

8585
// Locator to initialize exerciseDB
8686
await ServiceLocator().configure();
87+
print('running myapp');
8788
// Application
8889
runApp(const MyApp());
8990
}

lib/screens/home_tabs_screen.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
7474
/// Load initial data from the server
7575
Future<void> _loadEntries() async {
7676
final connector = DjangoConnector(db);
77-
final credentials = await connector.fetchCredentials();
78-
print('----------');
79-
print(credentials);
80-
print('----------');
77+
try {
78+
final credentials = await connector.fetchCredentials();
79+
print('----------');
80+
print(credentials);
81+
print('----------');
82+
} catch (e) {
83+
print('fail' + e.toString());
84+
}
8185

8286
final authProvider = context.read<AuthProvider>();
8387

0 commit comments

Comments
 (0)