Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 00314e8

Browse files
author
Mike Barnes
committed
Small updates and tweaks
1 parent c567a41 commit 00314e8

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

lib/models/todo_list.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ ORDER BY created_at
5959

6060
/// Create a new list
6161
static Future<TodoList> create(String name) async {
62+
final userId = getUserId();
63+
log.info('userId $userId');
6264
final results = await db.execute('''INSERT INTO
6365
lists(id, created_at, name, owner_id)
6466
VALUES(uuid(), datetime(), ?, ?)
65-
RETURNING *''', [name, getUserId()]);
67+
RETURNING *''', [name, userId]);
6668
return TodoList.fromRow(results.first);
6769
}
6870

lib/powersync.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ class BackendConnector extends PowerSyncBackendConnector {
3434

3535
BackendConnector(this.db);
3636

37-
/// Get a Supabase token to authenticate against the PowerSync instance.
37+
/// Get a token to authenticate against the PowerSync instance.
3838
@override
3939
Future<PowerSyncCredentials?> fetchCredentials() async {
40-
// Wait for pending session refresh if any
41-
// await _refreshFuture;
4240

4341
final user = FirebaseAuth.instance.currentUser;
4442
if(user == null) {
@@ -80,7 +78,6 @@ class BackendConnector extends PowerSyncBackendConnector {
8078
@override
8179
void invalidateCredentials() {
8280
// Trigger a session refresh if auth fails on PowerSync.
83-
// Generally, sessions should be refreshed automatically by Supabase.
8481
// However, in some cases it can be a while before the session refresh is
8582
// retried. We attempt to trigger the refresh as soon as we get an auth
8683
// failure on PowerSync.
@@ -90,10 +87,6 @@ class BackendConnector extends PowerSyncBackendConnector {
9087
//
9188
// Timeout the refresh call to avoid waiting for long retries,
9289
// and ignore any errors. Errors will surface as expired tokens.
93-
// _refreshFuture = Supabase.instance.client.auth
94-
// .refreshSession()
95-
// .timeout(const Duration(seconds: 5))
96-
// .then((response) => null, onError: (error) => null);
9790
}
9891

9992
// Upload pending changes to Node.js Backend.

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
logging: ^1.1.1
1919
firebase_core: ^2.24.0
2020
firebase_auth: ^4.15.0
21+
http: ^1.1.0
2122

2223
dev_dependencies:
2324
flutter_test:

0 commit comments

Comments
 (0)