feat: update primaryRole handling in authStore and adjust context role for clinics
This commit is contained in:
@@ -1783,11 +1783,11 @@ function ScheduleSection({ doctorUuid }: { doctorUuid: string }) {
|
||||
|
||||
const locationsQ = useQuery({
|
||||
queryKey: ['available-locations', doctorUuid],
|
||||
queryFn: () => api.get<ApiResponse<AddressData[]>>(`/api/v1/appointment-settings/available-locations/${doctorUuid}`),
|
||||
queryFn: () => api.get<ApiResponse<any>>(`/api/v1/appointment-settings/available-locations/${doctorUuid}`),
|
||||
enabled: !!doctorUuid,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
const availableLocations: AddressData[] = locationsQ.data?.data ?? [];
|
||||
const availableLocations: AddressData[] = locationsQ.data?.data?.data ?? locationsQ.data?.data ?? [];
|
||||
|
||||
return (
|
||||
<div className="cp-card p-6">
|
||||
|
||||
@@ -109,9 +109,10 @@ export const useAuthStore = create<AuthState>()(
|
||||
});
|
||||
if (res.success) {
|
||||
set({
|
||||
dbUuid: res.data.db_uuid,
|
||||
dbKey: res.data.db_key,
|
||||
context: res.data.context,
|
||||
dbUuid: res.data.db_uuid,
|
||||
dbKey: res.data.db_key,
|
||||
context: res.data.context,
|
||||
primaryRole: res.data.context?.role ?? null,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user