Skip to content

Commit

Permalink
chore: clean up connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicGBauer committed Dec 12, 2024
1 parent a919243 commit c8f6e97
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 32 deletions.
4 changes: 1 addition & 3 deletions demos/angular-supabase-todolist/src/app/supabase.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ export class SupabaseService implements PowerSyncBackendConnector {
}

return {
client: this.supabase,
endpoint: environment.powersyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export class DjangoConnector implements PowerSyncBackendConnector {
const session = await this.apiClient.getToken(userId);
return {
endpoint: AppConfig.powersyncUrl,
token: session.token ?? '',
expiresAt: undefined,
userID: userId
token: session.token ?? ''
};
}

Expand Down
3 changes: 1 addition & 2 deletions demos/react-multi-client/src/library/SupabaseConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export class SupabaseConnector extends BaseObserver<SupabaseConnectorListener> i

return {
token: token,
endpoint: import.meta.env.VITE_POWERSYNC_URL,
expiresAt: expires_at ? new Date(expires_at) : undefined
endpoint: import.meta.env.VITE_POWERSYNC_URL
};
}

Expand Down
5 changes: 1 addition & 4 deletions demos/react-native-supabase-group-chat/src/lib/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ export class Connector implements PowerSyncBackendConnector {
console.debug('session expires at', session.expires_at);

return {
client: this.supabaseClient,
endpoint: config.powerSyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined,
userID: session.user.id
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export class SupabaseConnector implements PowerSyncBackendConnector {

return {
endpoint: AppConfig.powersyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined,
userID: session.user.id
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export class SupabaseConnector implements PowerSyncBackendConnector {

return {
endpoint: AppConfig.powersyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined,
userID: session.user.id
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ export class SupabaseConnector extends BaseObserver<SupabaseConnectorListener> i

return {
endpoint: this.config.powersyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ export class SupabaseConnector extends BaseObserver<SupabaseConnectorListener> i

return {
endpoint: this.config.powersyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ export class SupabaseConnector extends BaseObserver<SupabaseConnectorListener> i

return {
endpoint: this.config.powersyncUrl,
token: session.access_token ?? '',
expiresAt: session.expires_at ? new Date(session.expires_at * 1000) : undefined
token: session.access_token ?? ''
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export class SupabaseConnector extends BaseObserver<SupabaseConnectorListener> i

return {
endpoint: data.powersync_url,
token: data.token,
expiresAt: undefined
token: data.token
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ Deno.serve(async (req) => {
}
);
} catch (err) {
return new Response(
JSON.stringify({ error: String(err?.message ?? err) }),
{ status: 500, headers: responseHeaders }
);
return new Response(JSON.stringify({ error: String(err?.message ?? err) }), {
status: 500,
headers: responseHeaders
});
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class SharedSyncClientProvider extends AbstractSharedSyncClientProvider {
*/
return {
endpoint: credentials.endpoint,
token: credentials.token,
expiresAt: credentials.expiresAt
token: credentials.token
};
}

Expand Down

0 comments on commit c8f6e97

Please sign in to comment.