Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Apply Prettier changes

awalias36f5630dc288
diff --git a/examples/nextjs-slack-clone/README.md b/examples/nextjs-slack-clone/README.md
index 6b6cd67822e..ded835ba9f1 100644
--- a/examples/nextjs-slack-clone/README.md
+++ b/examples/nextjs-slack-clone/README.md
@@ -115,7 +115,9 @@ Visit http://localhost:3000 and start chatting! Open a channel across two browse
## Supabase details
### Role-based access control (RBAC)
+
Use [plus addressing](https://en.wikipedia.org/wiki/Email_address#Subaddressing) to sign up users with the `admin` & `moderator` roles. Email addresses including `+supaadmin@` will be assigned the `admin` role, and email addresses including `+supamod@` will be assigned the `moderator` role. For example:
+
```
// admin user
@@ -123,6 +125,7 @@ [email protected]
// moderator user
```
+
Users with the `moderator` role can delete all messages. Users with the `admin` role can delete all messages and channels (note: it's not recommended to delete the `public` channel).
### Postgres Row level security
@@ -150,7 +153,7 @@ BEGIN
WHERE role_permissions.permission = authorize.requested_permission
AND user_roles.user_id = authorize.user_id
INTO bind_permissions;
-
+
RETURN bind_permissions > 0;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
diff --git a/examples/nextjs-slack-clone/lib/Store.js b/examples/nextjs-slack-clone/lib/Store.js
index 402aecd01be..4be314073e8 100644
--- a/examples/nextjs-slack-clone/lib/Store.js
+++ b/examples/nextjs-slack-clone/lib/Store.js
@@ -138,7 +138,7 @@ export const fetchUser = async (userId, setState) => {
* Fetch all roles for the current user
* @param {function} setState Optionally pass in a hook or callback to set the state
*/
- export const fetchUserRoles = async (setState) => {
+export const fetchUserRoles = async (setState) => {
try {
let { body } = await supabase.from('user_roles').select(`*`)
if (setState) setState(body)