Skip to content

Commit

Permalink
build(frontend): fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Falinor committed Nov 26, 2024
1 parent 899e143 commit 01800b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
5 changes: 4 additions & 1 deletion frontend/src/hooks/useHousing.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import _ from 'lodash';
import { useParams } from 'react-router-dom';
import { useMemo } from 'react';
import { assert } from 'ts-essentials';

import { useFindEventsByHousingQuery } from '../services/event.service';
import { useFindNotesByHousingQuery } from '../services/note.service';
import { useFindOwnersByHousingQuery } from '../services/owner.service';
import _ from 'lodash';
import { useCampaignList } from './useCampaignList';
import {
useCountHousingQuery,
Expand All @@ -14,6 +16,7 @@ import { isDefined } from '../utils/compareUtils';

export function useHousing() {
const { housingId } = useParams<{ housingId: string }>();
assert(housingId !== undefined, 'housingId is undefined');

const { data: housing } = useGetHousingQuery(housingId);

Expand Down
3 changes: 3 additions & 0 deletions frontend/src/hooks/useOwner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useParams } from 'react-router-dom';
import { assert } from 'ts-essentials';

import { useFindEventsByOwnerQuery } from '../services/event.service';
import { useGetOwnerQuery } from '../services/owner.service';
import {
Expand All @@ -12,6 +14,7 @@ interface UseOwnerOptions {

export function useOwner(options?: UseOwnerOptions) {
const { ownerId } = useParams<{ ownerId: string }>();
assert(ownerId !== undefined, 'ownerId is undefined');

const { data: owner } = useGetOwnerQuery(ownerId);

Expand Down
28 changes: 20 additions & 8 deletions frontend/src/utils/test/storeUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,31 @@ interface TestStoreOptions {
}

function configureTestStore(opts?: TestStoreOptions) {
const preloadedState = opts?.withAuth
? {
authentication: { authUser: genAuthUser() },
}
: {};

return configureStore({
reducer: applicationReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: false,
serializableCheck: false
}).concat(applicationMiddlewares),
preloadedState,
preloadedState: opts?.withAuth
? {
authentication: {
logIn: {
data: genAuthUser(),
isError: false,
isLoading: false,
isSuccess: true,
isUninitialized: false
},
changeEstablishment: {
isError: false,
isLoading: false,
isSuccess: false,
isUninitialized: true
}
}
}
: undefined
});
}

Expand Down

0 comments on commit 01800b2

Please sign in to comment.