rest API added

This commit is contained in:
gitea
2026-02-14 15:13:26 +01:00
parent c8ff07b490
commit d99b051a07
30 changed files with 1872 additions and 616 deletions
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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 () => {