0.0.3 • Published 3 years ago
ngx-supabase v0.0.3
NgxSupabase
Angular Module to use supabase with angular.
get started
install it
npm i ngx-supabase
add it to your module
import { NgxSupabaseModule } from 'ngx-supabase';
import { NgxSupabaseConfig } from "ngx-supabase";
export const config: NgxSupabaseConfig = {
supabaseUrl: "",
supabaseKey: "",
};
@NgModule({
imports: [
...,
NgxSupabaseModule.forRoot(config),
],
})
export class YourModule {}
and you are ready to go.
NgxSupabaseService is now available via DI
constructor(private supabase: NgxSupabaseService) {
// this.supabase.user
// this.supabase.rest
}
API
user
this.supabase.user
signUp(value: UserCredentials): Observable<NgxAuthResponse>
signIn(value: UserCredentials): Observable<NgxAuthResponse>
user(): User | null
logOut(): Observable<Error | null>
update(
attributes: UserAttributes
): Observable<{ data: User | null; user: User | null; error: Error | null }>
rest
this.supabase.rest
selectFrom(
tbl: string,
params?: SelectFromParams
): Observable<NgxSupaBaseSuccessResponse[]>
getCollumsFrom(tbl: string): Observable<string[]>
insertInto(
tbl: string,
data: { [key: string]: any }[],
upsert = false
): Observable<NgxSupaBaseSuccessResponse[]>
updateIn(
tbl: string,
data: { [key: string]: any },
params: SelectFromParams
): Observable<NgxSupaBaseSuccessResponse[]>
deleteFrom(tbl: string, params: SelectFromParams)