set address as default

This commit is contained in:
hamid zarghami
2025-12-01 15:23:26 +03:30
parent 4f5409f79a
commit 89e9a8c057
3 changed files with 5 additions and 3 deletions
@@ -15,6 +15,7 @@ import useToggle from '@/hooks/helpers/useToggle';
type Props = object
function UserAddressesPage({ }: Props) {
const { data: addressesResponse, isLoading } = useGetAddresses();
const router = useRouter();
const searchParams = useSearchParams();
@@ -101,7 +102,7 @@ function UserAddressesPage({ }: Props) {
addresses.map((address) => (
<div
key={address.id}
className={`bg-container rounded-container w-full shadow-xl px-4 py-4 flex flex-col justify-between ${address.isDefault ? 'ring-2 ring-primary' : ''}`}
className={`bg-container rounded-container w-full shadow-xl px-4 py-4 flex flex-col justify-between ${address.isDefault ? 'border border-primary' : ''}`}
>
<div className="flex justify-between items-start mb-2">
<h2 className='text-sm font-medium'>{address.title}</h2>
@@ -27,6 +27,6 @@ export const deleteAddress = async (id: string) => {
};
export const setDefaultAddress = async (id: string) => {
const { data } = await api.patch(`/public/user/addresses/${id}/set-default`);
const { data } = await api.patch(`/public/user/addresses/${id}/default`);
return data;
};