Add order page with real API calls
This commit is contained in:
@@ -256,16 +256,15 @@ export const useAuthStore = create<AuthState>()(
|
||||
onRehydrateStorage: () => (state) => {
|
||||
// Initialize API client with stored tokens when store rehydrates
|
||||
if (state?.token) {
|
||||
import('../api').then(({ apiClient }) => {
|
||||
apiClient.setAuthToken(state.token!);
|
||||
if (state.refreshToken) {
|
||||
apiClient.setRefreshToken(state.refreshToken);
|
||||
}
|
||||
// Use direct import to avoid timing issues
|
||||
apiClient.setAuthToken(state.token);
|
||||
if (state.refreshToken) {
|
||||
apiClient.setRefreshToken(state.refreshToken);
|
||||
}
|
||||
|
||||
if (state.user?.tenant_id) {
|
||||
apiClient.setTenantId(state.user.tenant_id);
|
||||
}
|
||||
});
|
||||
if (state.user?.tenant_id) {
|
||||
apiClient.setTenantId(state.user.tenant_id);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user