|
|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
import styles from './index.module.scss';
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import delve from 'dlv';
|
|
|
|
|
import {useRouter} from "next/router";
|
|
|
|
|
import {SubmitHandler, useForm} from 'react-hook-form';
|
|
|
|
|
import {BehaviorSubject, catchError, debounceTime, distinctUntilChanged, filter, map, of, switchMap} from "rxjs";
|
|
|
|
|
@ -10,37 +9,10 @@ import SeoConfig from "../../components/seo-config/seo-config";
|
|
|
|
|
import Layout from "../../components/layout/layout";
|
|
|
|
|
import {Inputs, signUpRequest} from "../../libs/api";
|
|
|
|
|
import {createJwtToken} from "../../libs/auth";
|
|
|
|
|
import {config} from "../../config";
|
|
|
|
|
import {environment} from "../../environments/environment";
|
|
|
|
|
|
|
|
|
|
const getPageMetadata = async (path) => {
|
|
|
|
|
try {
|
|
|
|
|
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
return Promise.resolve({})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getServerSideProps = async (context) => {
|
|
|
|
|
const path = context.resolvedUrl;
|
|
|
|
|
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
|
|
|
|
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
|
|
|
|
const page = await getPageMetadata(path);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: {
|
|
|
|
|
menuHeaders: delve(menuHeader, 'data.data.attributes.items.data', []),
|
|
|
|
|
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
|
|
|
|
page: delve(page, "data.data.0.attributes", {}),
|
|
|
|
|
seo: delve(page, "data.data.0.attributes.seo", {})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function SignUp({seo, menuHeaders, menuFooter}) {
|
|
|
|
|
export function SignUp({seo, menuHeader, menuFooter}) {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const {register, handleSubmit, watch, getValues, formState: {errors}, setError, clearErrors} = useForm({
|
|
|
|
|
const {register, handleSubmit, getValues, formState: {errors}, setError, clearErrors} = useForm({
|
|
|
|
|
defaultValues: {
|
|
|
|
|
email: "",
|
|
|
|
|
username: "",
|
|
|
|
|
@ -106,7 +78,7 @@ export function SignUp({seo, menuHeaders, menuFooter}) {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<SeoConfig {...seo}/>
|
|
|
|
|
<Layout menuHeader={menuHeaders} menuFooter={menuFooter}>
|
|
|
|
|
<Layout menuHeader={menuHeader} menuFooter={menuFooter}>
|
|
|
|
|
<div className={styles['page-sign-up']}>
|
|
|
|
|
<section className={styles['section']}>
|
|
|
|
|
<div className="container px-6 py-4 md:py-12 h-full mx-auto">
|
|
|
|
|
|