Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add onOrgJoined to update orgs after joining

Terry Suttone6e57cd9f806
diff --git a/studio/pages/join/index.tsx b/studio/pages/join/index.tsx
index dd0c93426ab..a2e5c416409 100644
--- a/studio/pages/join/index.tsx
+++ b/studio/pages/join/index.tsx
@@ -62,6 +62,7 @@ const JoinOrganizationPage = () => {
async function handleJoinOrganization() {
setIsSubmitting(true)
const response = await post(`${API_URL}/organizations/${slug}/members/join?token=${token}`, {})
+
if (response.error) {
ui.setNotification({
category: 'error',
@@ -70,7 +71,7 @@ const JoinOrganizationPage = () => {
setIsSubmitting(false)
} else {
setIsSubmitting(false)
- app.organizations.load()
+ app.onOrgJoined(response)
router.push('/')
}
}
diff --git a/studio/stores/app/AppStore.ts b/studio/stores/app/AppStore.ts
index e66507d00af..a8e774b8592 100644
--- a/studio/stores/app/AppStore.ts
+++ b/studio/stores/app/AppStore.ts
@@ -18,6 +18,7 @@ export interface IAppStore {
onProjectStatusUpdated: (projectId: number, value: string) => void
onProjectPostgrestStatusUpdated: (projectId: number, value: 'OFFLINE' | 'ONLINE') => void
onOrgAdded: (org: any) => void
+ onOrgJoined: (org: any) => void
onOrgUpdated: (org: any) => void
onOrgDeleted: (org: any) => void
}
@@ -104,6 +105,12 @@ export default class AppStore implements IAppStore {
}
}
+ onOrgJoined(org: Organization) {
+ if (org && org.id) {
+ this.organizations.data[org.id] = org
+ }
+ }
+
onOrgDeleted(org: Organization) {
if (org && org.id) {
const projects = values(this.projects.data)