fix: ensure apiClient initialization and update resource queries in authentication flow

This commit is contained in:
Mo Tarbin
2026-02-10 00:42:25 -05:00
parent 1ce7749826
commit 9c115efecb
6 changed files with 33 additions and 15 deletions

View File

@@ -36,6 +36,10 @@ export const AuthProvider = ({ children }) => {
const login = async credentials => {
setIsLoading(true)
try {
// Ensure apiClient is initialized with the correct URL
await apiClient.init()
const currentBaseURL = apiClient.getApiURL()
const isNative =
typeof window !== 'undefined' && window.Capacitor?.isNativePlatform?.()
@@ -50,7 +54,7 @@ export const AuthProvider = ({ children }) => {
config.credentials = 'include'
}
const response = await fetch(`${baseURL}/auth/login`, config)
const response = await fetch(`${currentBaseURL}/auth/login`, config)
if (!response.ok) {
const error = await response.json()