Hello, I am using SvelteKit and trying to send a user an invitation to the team, The email gets sent but automatically added to the team. From what i understand is that using client side this should not happen only if using the server sdk.
This is my simple function used inside my +page.svelte
try {
await teamsClient.createMembership(
teamId,
['staff'],
undefined,
id,
undefined,
'http://localhost:5173/team-users'
);
} catch (error) {
console.log(error);
}
}```
This is my set up for the appwrite client:
```import { PUBLIC_APPWRITE_ENDPOINT, PUBLIC_APPWRITE_PROJECT } from "$env/static/public";
import { Client, Teams } from "appwrite";
// Set up client
const client = new Client();
client.setEndpoint(PUBLIC_APPWRITE_ENDPOINT).setProject(PUBLIC_APPWRITE_PROJECT);
// Set up services
export const teamsClient = new Teams(client);```
Any suggestions?
- What error you're getting?
- Does the inviting user have
owner
role in the team?
Not getting any error. The inviting user is an owner yes.
I just want the user to be able to accept or deny this request and not automatically be added.
And the user didn't get an invite?
Yes the user got the invite via email, but the user was automatically added to the team.
So basically my flow in the app is that the owner of a team is signed in, and if he wants to invite a user he sends an email to join the team, but they are added immediatley after the inviteMember
function is complete with out the user accepting or ignoring the request.
I looked at the team and the memberships in the console, they are on the team but joined has n/a
, i just don't understand why they would be on the team at all with out clicking the link to accept the invite. I did not even create the logic for the link yet anyway.
Is the user shown as joined in the console?
No it does not show joined it shows n/a, but they are listed underneath the team, so in another part of my app, i query for team members and that user does show up. Is this normal Appwrite behavior? They just stay there if they ignore the email?
No, it's not the expected behavior
Let me check
BTW What version of Appwrite you're using?
Self Hosted 1.4.13
Recommended threads
- Upgrade Issue
Am having issue upgrading my appwrite account to pro as my card number is 19 and the required input is 16 digit
- Is there way to copy project (backup/res...
I think there is betterr way of fast back up / restore specified project
- Database setup
Hi everybody, I'm new to AppWrite and I need some help designing a database. I'm trying to set up a database where: 1. There are USERS 2. A USER can create an ...