The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Remove the mobx AuthStore since all of its functionality has been moved to react-query.
Ivan Vasilov3d254a8606aa
diff --git a/studio/stores/RootStore.ts b/studio/stores/RootStore.tsindex 0846dd49eef..f7d8e557d06 100644--- a/studio/stores/RootStore.ts+++ b/studio/stores/RootStore.ts@@ -2,14 +2,11 @@ import { configure } from 'mobx'import { Project } from 'types'import AppStore, { IAppStore } from './app/AppStore'import MetaStore, { IMetaStore } from './pgmeta/MetaStore'-import UiStore, { IUiStore } from './UiStore'+import ProjectBackupsStore, { IProjectBackupsStore } from './project/ProjectBackupsStore'import ProjectContentStore, { IProjectContentStore } from './project/ProjectContentStore'import ProjectFunctionsStore, { IProjectFunctionsStore } from './project/ProjectFunctionsStore'-import ProjectBackupsStore, { IProjectBackupsStore } from './project/ProjectBackupsStore'-import ProjectAuthConfigStore, {- IProjectAuthConfigStore,-} from './authConfig/ProjectAuthConfigStore'import VaultStore, { IVaultStore } from './project/VaultStore'+import UiStore, { IUiStore } from './UiStore'// Temporary disable mobx warnings// TODO: need to remove this after refactoring old stores.@@ -24,7 +21,6 @@ export interface IRootStore {content: IProjectContentStorefunctions: IProjectFunctionsStorebackups: IProjectBackupsStore- authConfig: IProjectAuthConfigStorevault: IVaultStoreselectedProjectRef?: string@@ -38,7 +34,6 @@ export class RootStore implements IRootStore {content: IProjectContentStorefunctions: IProjectFunctionsStorebackups: IProjectBackupsStore- authConfig: IProjectAuthConfigStorevault: IVaultStoreselectedProjectRef: string | undefined@@ -51,7 +46,6 @@ export class RootStore implements IRootStore {this.content = new ProjectContentStore(this, { projectRef: '' })this.functions = new ProjectFunctionsStore(this, { projectRef: '' })this.backups = new ProjectBackupsStore(this, { projectRef: '' })- this.authConfig = new ProjectAuthConfigStore(this, { projectRef: '' })this.vault = new VaultStore(this)}@@ -69,7 +63,6 @@ export class RootStore implements IRootStore {this.meta.setProjectDetails(project)this.functions.setProjectRef(project.ref)- this.authConfig.setProjectRef(project.ref)this.content.setProjectRef(project.ref)this.backups.setProjectRef(project.ref)// ui set must come lastdiff --git a/studio/stores/authConfig/ProjectAuthConfigStore.ts b/studio/stores/authConfig/ProjectAuthConfigStore.tsdeleted file mode 100644index 92c43762a59..00000000000--- a/studio/stores/authConfig/ProjectAuthConfigStore.ts+++ /dev/null@@ -1,113 +0,0 @@-import { makeAutoObservable, toJS } from 'mobx'-import { UserContentMap } from 'types'-import { IRootStore } from '../RootStore'-import { API_URL } from 'lib/constants'-import { get, patch } from 'lib/common/fetch'--export interface IProjectAuthConfigStore {- isLoading: boolean- isInitialized: boolean- isLoaded: boolean- error: any- config: any-- baseUrl: string- projectRef: string-- load: () => void- update: (updates: any) => Promise<any>- setProjectRef: (ref?: string) => void-}--export default class ProjectAuthConfigStore implements IProjectAuthConfigStore {- rootStore: IRootStore- STATES = {- INITIAL: 'initial',- LOADING: 'loading',- ERROR: 'error',- LOADED: 'loaded',- }- baseUrl: string- projectRef: string- // @ts-ignore- data: UserContentMap = []-- state = this.STATES.INITIAL- error = null-- constructor(rootStore: IRootStore, options: { projectRef: string }) {- const { projectRef } = options- this.projectRef = projectRef- this.rootStore = rootStore- this.baseUrl = ``- makeAutoObservable(this)- }-- get isLoading() {- return this.state === this.STATES.INITIAL || this.state === this.STATES.LOADING- }-- get isInitialized() {- return this.state !== this.STATES.INITIAL- }-- get isLoaded() {- return this.state === this.STATES.LOADED- }-- get config() {- return this.data- }-- async fetchData() {- const headers = { 'Content-Type': 'application/json' }- const response = await get(this.baseUrl, { headers })-- if (response.error) throw response.error- this.data = response- return response- }-- async load() {- let { LOADING, ERROR, LOADED } = this.STATES- try {- this.error = null- this.state = LOADING- await this.fetchData()- this.state = LOADED- return this.data- } catch (e: any) {- this.error = e- this.state = ERROR- }- }-- byId(id: any) {- return toJS(this.data)[id]- }-- async update(updates: any) {- try {- const headers = {- 'Content-Type': 'application/json',- }- let payload = {- ...updates,- }- const url = `${this.baseUrl}`- const updated = await patch(url, payload, { headers })- if (updated.error) throw updated.error- this.data = updated- return { data: updated, error: null }- } catch (error) {- return { data: null, error }- }- }-- setProjectRef(ref?: string) {- if (ref) {- this.projectRef = ref- this.baseUrl = `${API_URL}/auth/${ref}/config`- }- }-}