0.1.16 • Published 3 years ago

@edgarbarrantes/supabase-swr v0.1.16

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Supabase SWR

Allows using SWR with simple supabase queries.

Examples:

export const { useGetEntries } = getSupabaseSWR(
  process.env.NEXT_PUBLIC_SUPABASE_URL || '',
  process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || '',
)

const {
  data: users,
  error,
  isLoading,
} = useGetEntries<Users>(
  session.access_token,
  // Name of the table.
  'users',
  // Fields to get the query from.
  ['name', 'uuid'],
  // Collection of filters
  [
    { field: 'order', relationship: 'name', value: 'asc' },
    { field: 'age', relationship: 'lt', value: '18' },
  ],
  // Range (selects the first 3 items)
  [0, 2],
)

You can pretty much use the filters available here that supabase allows for: https://postgrest.org/en/v7.0.0/api.html

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago