Skip to content

Commit

Permalink
fix: user id no longer in fetchCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicGBauer committed Dec 17, 2024
1 parent 3abde29 commit c541bc8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const App = () => {
return;
}

const { userID } = await system.djangoConnector.fetchCredentials();
const userID = await system.djangoConnector.userId();

await system.powersync.execute(
`INSERT INTO ${LIST_TABLE} (id, created_at, name, owner_id) VALUES (uuid(), datetime(), ?, ?)`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export class DjangoConnector implements PowerSyncBackendConnector {
return this.apiClient.register(username, password);
}

async userId() {
return Storage.getItem('id');
}

async fetchCredentials() {
// The demo does not invalidate or update a user token, you should implement this in your app
// The app stores the user id in local storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const TodoView: React.FC = () => {
};

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

await powerSync.execute(
`INSERT INTO
Expand Down

0 comments on commit c541bc8

Please sign in to comment.