Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions example/next-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ begin;
commit;

alter publication supabase_realtime add table profiles;

-- Set up Storage!
insert into storage.buckets (id, name) values ('avatars', 'avatars');
create policy "Avatar images are publicly accessible." on storage.objects for select using (true);
create policy "Inserted avatar file name starts with the user's id." on storage.objects for insert with check (auth.uid()::text = substring(name, 1, 36));
create policy "Updated avatar file name starts with the user's id." on storage.objects for update with check (auth.uid()::text = substring(name, 1, 36));
```
6 changes: 3 additions & 3 deletions example/next-storage/components/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function Account({ session }: { session: AuthSession }) {
}

let { error: updateError } = await supabase.from('profiles').upsert({
id: user.id,
id: user!.id,
avatar_url: filePath,
})

Expand Down Expand Up @@ -73,7 +73,7 @@ export default function Account({ session }: { session: AuthSession }) {
let { data, error } = await supabase
.from('profiles')
.select(`username, website, avatar_url`)
.eq('id', user.id)
.eq('id', user!.id)
.single()

if (error) {
Expand All @@ -94,7 +94,7 @@ export default function Account({ session }: { session: AuthSession }) {
const user = supabase.auth.user()

const updates = {
id: user.id,
id: user!.id,
username,
website,
updated_at: new Date(),
Expand Down
3 changes: 2 additions & 1 deletion example/next-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"react-dom": "17.0.1"
},
"devDependencies": {
"@types/react": "^17.0.3"
"@types/react": "^17.0.3",
"typescript": "^4.2.3"
}
}