rest API added
This commit is contained in:
@@ -44,7 +44,7 @@ function createAuthStore() {
|
||||
return false;
|
||||
}
|
||||
if (!email.includes('@')) {
|
||||
const resolved = await getEmailForUsername(email);
|
||||
const resolved = await getEmailForUsername(supabase, email);
|
||||
if (!resolved) {
|
||||
update((s) => ({ ...s, error: 'No account with that username.' }));
|
||||
return false;
|
||||
@@ -79,7 +79,7 @@ function createAuthStore() {
|
||||
update((s) => ({ ...s, error: null }));
|
||||
if (data?.user?.id && data?.session && (displayName || '').trim()) {
|
||||
try {
|
||||
await updateProfile(data.user.id, { display_name: (displayName || '').trim() });
|
||||
await updateProfile(supabase, data.user.id, { display_name: (displayName || '').trim() });
|
||||
} catch (_) {}
|
||||
}
|
||||
const needsConfirmation = data?.user && !data?.session;
|
||||
|
||||
@@ -67,7 +67,7 @@ describe('auth store', () => {
|
||||
mockGetEmailForUsername.mockResolvedValue('[email protected]')
|
||||
mockSignInWithPassword.mockResolvedValue({ error: null })
|
||||
const result = await auth.login('username', 'pass')
|
||||
expect(mockGetEmailForUsername).toHaveBeenCalledWith('username')
|
||||
expect(mockGetEmailForUsername).toHaveBeenCalledWith(expect.anything(), 'username')
|
||||
expect(mockSignInWithPassword).toHaveBeenCalledWith({
|
||||
email: '[email protected]',
|
||||
password: 'pass',
|
||||
@@ -112,7 +112,7 @@ describe('auth store', () => {
|
||||
mockSignUp.mockResolvedValue({ data: { user, session: {} }, error: null })
|
||||
mockUpdateProfile.mockResolvedValue(undefined)
|
||||
await auth.register('[email protected]', 'pass', 'Alice')
|
||||
expect(mockUpdateProfile).toHaveBeenCalledWith('u1', { display_name: 'Alice' })
|
||||
expect(mockUpdateProfile).toHaveBeenCalledWith(expect.anything(), 'u1', { display_name: 'Alice' })
|
||||
})
|
||||
|
||||
it('register with signUp error returns success false', async () => {
|
||||
|
||||
Reference in New Issue
Block a user