Skip to content

Commit c541bc8

Browse files
committed
fix: user id no longer in fetchCredentials
1 parent 3abde29 commit c541bc8

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

demos/django-react-native-todolist/app/views/todos/lists.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const App = () => {
3434
return;
3535
}
3636

37-
const { userID } = await system.djangoConnector.fetchCredentials();
37+
const userID = await system.djangoConnector.userId();
3838

3939
await system.powersync.execute(
4040
`INSERT INTO ${LIST_TABLE} (id, created_at, name, owner_id) VALUES (uuid(), datetime(), ?, ?)`,

demos/django-react-native-todolist/library/django/DjangoConnector.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export class DjangoConnector implements PowerSyncBackendConnector {
3535
return this.apiClient.register(username, password);
3636
}
3737

38+
async userId() {
39+
return Storage.getItem('id');
40+
}
41+
3842
async fetchCredentials() {
3943
// The demo does not invalidate or update a user token, you should implement this in your app
4044
// The app stores the user id in local storage

demos/react-native-supabase-todolist/app/views/todos/edit/[id].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const TodoView: React.FC = () => {
8686
};
8787

8888
const createNewTodo = async (description: string) => {
89-
const { userID } = await system.supabaseConnector.fetchCredentials();
89+
const userID = await system.supabaseConnector.userId();
9090

9191
await powerSync.execute(
9292
`INSERT INTO

0 commit comments

Comments
 (0)