Skip to content

Develop to Main #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 16, 2025
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
Binary file added .github/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<img alt="SkateHub" title="SkateHub" src=".github/skatehub.svg" />
</h1>

![screenshot](.github/screenshot.png)

<p align="center">
<a href="#gear-build-setup">Build setup</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#memo-changelog">Changelog</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;
Expand Down Expand Up @@ -80,6 +82,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: {}
};
};