Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ And that's it! Your `SkateHub Frontend` should now be up and running locally on

### 2025

- 2025-01-15 - Move authentication logic to user edit page [#116](https://github.com/jpcmf/Frontend-GraduateProgram-FullStack-2024/pull/116) _(v0.1.33)_

### 2024

- 2024-12-31 - Add `instagram_url` field to user profile and update related forms [#113](https://github.com/jpcmf/Frontend-GraduateProgram-FullStack-2024/pull/113) _(v0.1.32)_
Expand Down
17 changes: 0 additions & 17 deletions src/features/user/edit/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { z } from "zod";
import { useRouter } from "next/router";
import { zodResolver } from "@hookform/resolvers/zod";
import { parseCookies } from "nookies";
import { SubmitHandler, useForm } from "react-hook-form";
import { useContext, useEffect, useState } from "react";
import { Box, Button, Flex, Heading, Divider, SimpleGrid, VStack, HStack } from "@chakra-ui/react";
Expand Down Expand Up @@ -164,19 +163,3 @@ export function UserEdit() {
</Layout>
);
}

export const getServerSideProps = async (ctx: any) => {
const { ["auth.token"]: token } = parseCookies(ctx);

if (!token) {
return {
redirect: {
destination: "/",
permanent: false
}
};
}
return {
props: {}
};
};
17 changes: 17 additions & 0 deletions src/pages/user/edit.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import { parseCookies } from "nookies";
import { UserEdit } from "@/features/user/edit";

export default function UserEditPage() {
return <UserEdit />;
}

export const getServerSideProps = async (ctx: any) => {
const { ["auth.token"]: token } = parseCookies(ctx);

if (!token) {
return {
redirect: {
destination: "/",
permanent: false
}
};
}
return {
props: {}
};
};