mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Fix brewery creation
This commit is contained in:
@@ -108,7 +108,8 @@ const LocationSection: FC<{
|
|||||||
errors: FieldErrors<z.infer<typeof CreateBreweryPostWithImagesSchema>>;
|
errors: FieldErrors<z.infer<typeof CreateBreweryPostWithImagesSchema>>;
|
||||||
isSubmitting: boolean;
|
isSubmitting: boolean;
|
||||||
setValue: UseFormSetValue<z.infer<typeof CreateBreweryPostWithImagesSchema>>;
|
setValue: UseFormSetValue<z.infer<typeof CreateBreweryPostWithImagesSchema>>;
|
||||||
}> = ({ register, errors, isSubmitting, setValue }) => {
|
mapboxAccessToken: string;
|
||||||
|
}> = ({ register, errors, isSubmitting, setValue, mapboxAccessToken }) => {
|
||||||
const onAutoCompleteChange = (address: string) => {
|
const onAutoCompleteChange = (address: string) => {
|
||||||
setValue('address', address);
|
setValue('address', address);
|
||||||
};
|
};
|
||||||
@@ -133,7 +134,7 @@ const LocationSection: FC<{
|
|||||||
</FormInfo>
|
</FormInfo>
|
||||||
<FormSegment>
|
<FormSegment>
|
||||||
<AddressAutofill
|
<AddressAutofill
|
||||||
accessToken={process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN!}
|
accessToken={mapboxAccessToken}
|
||||||
onRetrieve={onAutoCompleteRetrieve}
|
onRetrieve={onAutoCompleteRetrieve}
|
||||||
onChange={onAutoCompleteChange}
|
onChange={onAutoCompleteChange}
|
||||||
>
|
>
|
||||||
@@ -201,7 +202,9 @@ const LocationSection: FC<{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CreateBreweryPostForm: FC = () => {
|
const CreateBreweryPostForm: FC<{
|
||||||
|
mapboxAccessToken: string;
|
||||||
|
}> = ({ mapboxAccessToken }) => {
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
@@ -268,6 +271,7 @@ const CreateBreweryPostForm: FC = () => {
|
|||||||
register={register}
|
register={register}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
|
mapboxAccessToken={mapboxAccessToken}
|
||||||
/>
|
/>
|
||||||
</Tab.Panel>
|
</Tab.Panel>
|
||||||
</Tab.Panels>
|
</Tab.Panels>
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import FormPageLayout from '@/components/ui/forms/FormPageLayout';
|
import FormPageLayout from '@/components/ui/forms/FormPageLayout';
|
||||||
import withPageAuthRequired from '@/util/withPageAuthRequired';
|
import withPageAuthRequired from '@/util/withPageAuthRequired';
|
||||||
import { GetServerSideProps, NextPage } from 'next';
|
import { NextPage } from 'next';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
|
|
||||||
import { FaBeer } from 'react-icons/fa';
|
import { FaBeer } from 'react-icons/fa';
|
||||||
import CreateBreweryPostForm from '@/components/BreweryPost/CreateBreweryPostForm';
|
import CreateBreweryPostForm from '@/components/BreweryPost/CreateBreweryPostForm';
|
||||||
|
import { MAPBOX_ACCESS_TOKEN } from '@/config/env';
|
||||||
|
|
||||||
const CreateBreweryPage: NextPage = () => {
|
interface CreateBreweryPageProps {
|
||||||
|
mapboxAccessToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CreateBreweryPage: NextPage<CreateBreweryPageProps> = ({ mapboxAccessToken }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
@@ -20,7 +25,7 @@ const CreateBreweryPage: NextPage = () => {
|
|||||||
headingText="Create Brewery"
|
headingText="Create Brewery"
|
||||||
headingIcon={FaBeer}
|
headingIcon={FaBeer}
|
||||||
>
|
>
|
||||||
<CreateBreweryPostForm />
|
<CreateBreweryPostForm mapboxAccessToken={mapboxAccessToken} />
|
||||||
</FormPageLayout>
|
</FormPageLayout>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -30,4 +35,6 @@ const CreateBreweryPage: NextPage = () => {
|
|||||||
|
|
||||||
export default CreateBreweryPage;
|
export default CreateBreweryPage;
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = withPageAuthRequired();
|
export const getServerSideProps = withPageAuthRequired<CreateBreweryPageProps>(
|
||||||
|
async () => ({ props: { mapboxAccessToken: MAPBOX_ACCESS_TOKEN } }),
|
||||||
|
);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import useGetUsersFollowingUser from '@/hooks/data-fetching/user-follows/useGetU
|
|||||||
|
|
||||||
import UpdateProfileSchema from '@/services/User/schema/UpdateProfileSchema';
|
import UpdateProfileSchema from '@/services/User/schema/UpdateProfileSchema';
|
||||||
import sendUpdateUserAvatarRequest from '@/requests/Account/sendUpdateUserAvatarRequest';
|
import sendUpdateUserAvatarRequest from '@/requests/Account/sendUpdateUserAvatarRequest';
|
||||||
import sendUpdateUserProfileRequest from '@/requests/Account/sendUpdateUserProfileRequest.ts';
|
import sendUpdateUserProfileRequest from '@/requests/Account/sendUpdateUserProfileRequest';
|
||||||
import Spinner from '@/components/ui/Spinner';
|
import Spinner from '@/components/ui/Spinner';
|
||||||
|
|
||||||
const ProfilePage: NextPage = () => {
|
const ProfilePage: NextPage = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user