B2B-30: adds personal code to account, company admins invites members

This commit is contained in:
devmc-ee
2025-06-22 15:22:07 +03:00
parent 39c02c6d34
commit 251f2a4ef1
50 changed files with 3546 additions and 2611 deletions

View File

@@ -3,6 +3,7 @@ import { useMutation } from '@tanstack/react-query';
import { useSupabase } from './use-supabase';
interface Credentials {
personalCode: string;
email: string;
password: string;
emailRedirectTo: string;
@@ -14,13 +15,17 @@ export function useSignUpWithEmailAndPassword() {
const mutationKey = ['auth', 'sign-up-with-email-password'];
const mutationFn = async (params: Credentials) => {
const { emailRedirectTo, captchaToken, ...credentials } = params;
const { emailRedirectTo, captchaToken, personalCode, ...credentials } = params;
// TODO?: should be a validation of unique personal code before registration
const response = await client.auth.signUp({
...credentials,
options: {
emailRedirectTo,
captchaToken,
data: {
personalCode
}
},
});