Skip to content

Commit

Permalink
Merge pull request #1 from EdgarBarrantes/add-new-libraries
Browse files Browse the repository at this point in the history
Add new libraries
  • Loading branch information
EdgarBarrantes authored Aug 11, 2021
2 parents 046f42e + 37752d2 commit 348aa04
Show file tree
Hide file tree
Showing 23 changed files with 18,192 additions and 1,393 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
.yalc
tsconfig.tsbuildinfo
lerna-debug.log
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Supabase SWR
# Supabase utilities for consuming data

Monorepo that includes several packages related to interactions with supabase.

## Supabase SWR

Allows using [SWR](https://swr.vercel.app/) with simple supabase queries.

Expand Down Expand Up @@ -31,3 +35,26 @@ const {
```

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

## Supabase fetcher helpers

Includes a fetcher function and helpers.

```ts
const apiKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY // Or however you store you're key.
const fetcher = getFetcher(apiKey)

const token = session.access_token // User's access token.
const apiUrl = process.env.NEXT_PUBLIC_SUPABASE_URL // https://something.supabase.co
const table = 'consumers'
const { select, filterString, rangeString } = getOptions(fields, filters, range)

const data = await fetcher(
token,
apiUrl,
table,
select,
filterString,
rangeString,
)
```
6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": [
"packages/*"
],
"version": "0.1.15"
}
Loading

0 comments on commit 348aa04

Please sign in to comment.