Skip to content

add Zustand auth and cart stores with secure token persistence#178

Merged
zakkiyyat merged 3 commits intoMixMatch-Inc:mainfrom
wumibals:mobile-state
Mar 8, 2026
Merged

add Zustand auth and cart stores with secure token persistence#178
zakkiyyat merged 3 commits intoMixMatch-Inc:mainfrom
wumibals:mobile-state

Conversation

@wumibals
Copy link
Contributor

@wumibals wumibals commented Mar 8, 2026

Sets up global state management for the mobile app using Zustand, covering the two most critical slices — authentication and the cart.

useAuthStore holds the user object, token, and login/logout actions. The token is persisted to expo-secure-store so sessions survive app restarts, and the store hydrates it automatically on load. Logging out clears both in-memory state and the secure storage entry.

useCartStore manages the array of matched food items with add, remove, and clear actions.

Acceptance criteria

  • ✅ Auth token persists across restarts via expo-secure-store
  • ✅ Store hydrates the token correctly on app load
  • ✅ Logout clears state and removes token from secure storage
  • ✅ Cart supports add, remove, and clear

closes #139

@zakkiyyat zakkiyyat merged commit f56e907 into MixMatch-Inc:main Mar 8, 2026
1 check passed
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.

Mobile State Architecture (Zustand)

2 participants