Skip to content

Commit

Permalink
fix: deployment (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruilopesm authored Jan 30, 2024
1 parent 8651241 commit 6a3ddaf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 49 deletions.
16 changes: 13 additions & 3 deletions layout/Attendee/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import Button from "@components/Button";
import Heading from "@components/Heading";
import ResetPassword from "@components/ResetPassword";

import { CheckpointTracker, CodeInput } from "./components";
import { CheckpointTracker } from "./components";
import CVInput from "./components/CVInput";
import { resetPassword } from "@lib/api";
import { getFirstName } from "@lib/naming";
import { getCourses } from "@lib/api";

interface Course {
id: any;
name: string;
}

function Profile({ courses }) {
function Profile() {
const { user, editUser } = useAuth() as {
user: IAttendee;
editUser: (username: FormData) => void;
Expand All @@ -31,6 +31,16 @@ function Profile({ courses }) {
const [username, setUsername] = useState(user.nickname || "");
const [course, setCourse] = useState(user.course.toString() || "");

const [courses, setCourses] = useState<Course[]>([
{ id: "", name: "None" },
]);

useEffect(() => {
getCourses().then((response) => {
setCourses(response.data.concat(courses));
});
}, []);

const [photoFileUrl, setPhotoFileUrl] = useState<string>(user.avatar);

const companyBadges = user.badges.filter((entry) => entry.type == 4).length;
Expand Down
22 changes: 20 additions & 2 deletions layout/SignUp/SignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import { useEffect, useState } from "react";

import { motion as Motion } from "framer-motion";

import Card from "@components/Card";
import Return from "@components/Return";
import { SignUpForm } from "./components";

import Title from "@layout/moonstone/authentication/Title";
import Text from "@layout/moonstone/authentication/Text";

function Signup({ courses }) {
import { getCourses } from "@lib/api";

interface Course {
id: any;
name: string;
}

function Signup() {
const [courses, setCourses] = useState<Course[]>([
{ id: "", name: "None" },
]);

useEffect(() => {
getCourses().then((response) => {
setCourses(response.data.concat(courses));
});
}, []);

return (
<div className="min-h-screen select-none overflow-hidden bg-secondary">
<Return componentStyle="sm:ml-14 mt-10 sm:mt-20 mb-6" />
Expand Down
15 changes: 0 additions & 15 deletions pages/attendee/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
import Profile from "@layout/Attendee/Profile";

import { getCourses } from "@lib/api";

export async function getServerSideProps(context) {
context.res.setHeader(
"Cache-Control",
"public, s-maxage=3600, stale-while-revalidate=3600"
);

const courses = await getCourses().then((response) =>
response.data.concat({ id: "", name: "None" })
);

return { props: { courses: courses } };
}

export default Profile;
25 changes: 11 additions & 14 deletions pages/register/[uuid].js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,7 @@ import PasswordInput from "@components/PasswordInput";
import Title from "@layout/moonstone/authentication/Title";
import Text from "@layout/moonstone/authentication/Text";

export async function getServerSideProps(context) {
context.res.setHeader(
"Cache-Control",
"public, s-maxage=3600, stale-while-revalidate=3600"
);

const courses = await getCourses().then((response) =>
response.data.concat({ id: "", name: "None" })
);

return { props: { courses: courses } };
}

function Register({ courses }) {
function Register() {
const { sign_up, errors, isLoading } = useAuth();
const router = useRouter();
const { uuid } = router.query;
Expand All @@ -42,6 +29,16 @@ function Register({ courses }) {
const [password, updatePassword] = useState("");
const [password_confirmation, updatePasswordConfirmation] = useState("");

const [courses, setCourses] = useState([
{ id: "", name: "None" }
]);

useEffect(() => {
getCourses().then((response) => {
setCourses(response.data.concat(courses));
});
}, []);

const onFinish = (e) => {
e.preventDefault();
sign_up({
Expand Down
15 changes: 0 additions & 15 deletions pages/signup.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
import { getCourses } from "@lib/api";

import SignUp from "@layout/SignUp";

export async function getServerSideProps(context) {
context.res.setHeader(
"Cache-Control",
"public, s-maxage=3600, stale-while-revalidate=3600"
);

const courses = await getCourses().then((response) =>
response.data.concat({ id: "", name: "None" })
);

return { props: { courses: courses } };
}

export default SignUp;

0 comments on commit 6a3ddaf

Please sign in to comment.