Skip to content

Conversation

@Cedarich
Copy link
Contributor

@Cedarich Cedarich commented Sep 27, 2025

Summary

  • Implemented a Sign Up screen that validates input, calls the signup API, shows loading and error states, and navigates to login on success.
  • Added a reusable, type-safe useApi hook for handling request state and errors.
  • Added authApi.signUp that posts to /auth/signup via the shared apiClient.

Changes

  • mobile/app/signup.tsx

    • Created SignUpScreen using Formik + Yup
    • Added ActivityIndicator for loading, error display, and success Alert
    • Implemented navigation with expo-router
  • mobile/services/authApi.ts

    • Added authApi.signUp(payload) returning AxiosResponse<{ message: string }>
  • mobile/services/useAPI.ts

    • Added generic useApi<T, P> hook to manage data, loading, and error using AxiosResponse typing

How it Works

  • Validation:

    • Yup ensures name, email, password, and confirm password are correct.
  • On Submit:

    • useApi calls authApi.signUp and returns { success, data, error }.
    • On success, shows an Alert with the server message and navigates to /login.
    • On error, displays the API error message or a generic fallback.

Test Plan

  1. Start the mobile app and navigate to the Sign Up screen.
  2. Enter invalid inputs → verify inline validation errors.
  3. Enter valid inputs → submit and confirm:
    • Loading spinner appears.
    • Request completes and success Alert is shown.
  4. Simulate a server/network error → verify error message under the form.
  5. Confirm app navigates to /login after a successful signup.

Notes / Dependencies

  • Ensure apiClient is configured with the correct base URL.
  • Backend must expose POST /auth/signup.
  • Project must include Axios and React types for TypeScript.
  • No breaking changes to existing screens.

@zakkiyyat zakkiyyat merged commit c980d27 into MixMatch-Inc:main Sep 28, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants