Skip to content

Commit 75a0009

Browse files
kelvinsbmarcodmc
authored and
marcodmc
committed
fix: send address field formatted (SOS-RS#171)
1 parent 38d7c14 commit 75a0009

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pages/CreateShelter/CreateShelter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { clearCache } from '@/api/cache';
2323
import { hardCodedRsCities } from './hardcodedCities';
2424
import { useDebouncedValue, useViaCep } from '@/hooks';
2525
import { cn } from '@/lib/utils';
26+
import { checkAndFormatAddress } from '@/components/CardAboutShelter';
27+
import { IUseShelterData } from '@/hooks/useShelter/types';
2628

2729
const CreateShelterComponent = () => {
2830
const navigate = useNavigate();
@@ -74,7 +76,8 @@ const CreateShelterComponent = () => {
7476
}),
7577
onSubmit: async (values, { resetForm }) => {
7678
try {
77-
await ShelterServices.create(values);
79+
const address = checkAndFormatAddress(values as IUseShelterData);
80+
await ShelterServices.create({ ...values, address });
7881
clearCache(false);
7982
toast({
8083
title: 'Cadastro feita com sucesso',

0 commit comments

Comments
 (0)