Auth: Use dedicated sign-in/sign-up endpoints

Update the sign-in and sign-up calls to use the specific `/email`
subpaths, aligning with the backend API structure.
This commit is contained in:
bananabas 2026-04-13 19:17:25 +01:00
parent 094853c9da
commit 440d668d2c

View file

@ -137,7 +137,7 @@ class AppState: ObservableObject {
do {
// Try sign in first
let signInPayload = SignInPayload(email: email, password: password)
let signInResponse: APIResponse<AuthResponse> = try await apiClient.post("api/auth/sign-in", body: signInPayload)
let signInResponse: APIResponse<AuthResponse> = try await apiClient.post("api/auth/sign-in/email", body: signInPayload)
// If sign in succeeds, use that response
if let authData = signInResponse.data, signInResponse.error == nil {
@ -147,7 +147,7 @@ class AppState: ObservableObject {
// If sign in fails with user not found, try sign up
let displayName = email.split(separator: "@").first.map(String.init) ?? email
let signUpPayload = SignUpPayload(email: email, password: password, name: displayName)
let signUpResponse: APIResponse<AuthResponse> = try await apiClient.post("api/auth/sign-up", body: signUpPayload)
let signUpResponse: APIResponse<AuthResponse> = try await apiClient.post("api/auth/sign-up/email", body: signUpPayload)
if let error = signUpResponse.error {
throw AuthError.serverError(message: error.message)