mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 22:59:11 +03:00
* Replace all methods of MetaStore with react queries. * Remove unneeded usages of MetaStore. * Remove RootStore completely. The only thing left from these stores is uiStore. * Remove unnecessary comments. * Delete MetaStore. * Fix the usage of the wrong toaster. * Remove unused variables * Remove onSqlQuery * Convert some ui setNotification calls to direct toast calls --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import type { SupaRow } from '../../types'
|
|
|
|
export interface CallbackInitialState {
|
|
onAddColumn: (() => void) | null
|
|
onAddRow: (() => void) | null
|
|
onError: ((error: any) => void) | null
|
|
onEditRow: ((row: SupaRow) => void) | null
|
|
onEditColumn: ((columnName: string) => void) | null
|
|
onDeleteColumn: ((columnName: string) => void) | null
|
|
}
|
|
|
|
export const callbackInitialState: CallbackInitialState = {
|
|
onAddColumn: null,
|
|
onAddRow: null,
|
|
onError: null,
|
|
onEditRow: null,
|
|
onEditColumn: null,
|
|
onDeleteColumn: null,
|
|
}
|
|
|
|
type CALLBACK_ACTIONTYPE = {
|
|
type: 'INIT_CALLBACK'
|
|
payload: {
|
|
onAddColumn: (() => void) | null
|
|
onAddRow: (() => void) | null
|
|
onError: ((error: any) => void) | null
|
|
onEditRow: ((row: SupaRow) => void) | null
|
|
onEditColumn: ((columnName: string) => void) | null
|
|
onDeleteColumn: ((columnName: string) => void) | null
|
|
}
|
|
}
|
|
|
|
const CallbackReducer = (state: CallbackInitialState, action: CALLBACK_ACTIONTYPE) => {
|
|
switch (action.type) {
|
|
case 'INIT_CALLBACK': {
|
|
return {
|
|
...state,
|
|
onAddColumn: action.payload.onAddColumn,
|
|
onAddRow: action.payload.onAddRow,
|
|
onError: action.payload.onError,
|
|
onEditRow: action.payload.onEditRow,
|
|
onEditColumn: action.payload.onEditColumn,
|
|
onDeleteColumn: action.payload.onDeleteColumn,
|
|
}
|
|
}
|
|
|
|
default:
|
|
return state
|
|
}
|
|
}
|
|
|
|
export default CallbackReducer
|