Skip to content
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

Feature/redirect login #123

Merged
merged 2 commits into from
Jul 12, 2024
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
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-issue.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: bug issue
about: bug issue
title: ""
title: "[Bug]: "
labels: bug
assignees: YukiOnishi1129
projects: ["YukiOnishi1129/3"]
---

# Summary
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature-todo.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: feature todo
about: feature todo
title: ''
title: "[Feature]: "
labels: enhancement
assignees: YukiOnishi1129
projects: ["YukiOnishi1129/3"]

---

Expand Down
9 changes: 8 additions & 1 deletion web/client/src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { redirect } from "next/navigation";
import { Suspense } from "react";

import { LoginTemplate } from "@/features/auth/components/LoginTemplate";
import { getUser } from "@/features/users/actions/user";

import { ScreenLoader } from "@/components/layout/ScreenLoader";

export default function Login() {
export default async function Login() {
const user = await getUser();
if (user) {
redirect("/dashboard/trend");
}

return (
<Suspense fallback={<ScreenLoader />}>
<LoginTemplate />
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/app/dashboard/company/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type PageProps = {
export default async function DashboardSitePage({ searchParams }: PageProps) {
const user = await getUser();
if (!user) {
redirect("/");
redirect("/login");
}
const languageStatus =
typeof searchParams["languageStatus"] === "string"
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/app/dashboard/site/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type PageProps = {
export default async function DashboardSitePage({ searchParams }: PageProps) {
const user = await getUser();
if (!user) {
redirect("/");
redirect("/login");
}
const languageStatus =
typeof searchParams["languageStatus"] === "string"
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/app/dashboard/summary/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function DashboardSummaryPage({
}: PageProps) {
const user = await getUser();
if (!user) {
redirect("/");
redirect("/login");
}
const languageStatus =
typeof searchParams["languageStatus"] === "string"
Expand Down
5 changes: 1 addition & 4 deletions web/client/src/app/dashboard/trend/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type PageProps = {
export default async function TrendDashboardPage({ searchParams }: PageProps) {
const user = await getUser();
if (!user) {
redirect("/");
redirect("/login");
}

const languageStatus =
Expand All @@ -37,9 +37,6 @@ export default async function TrendDashboardPage({ searchParams }: PageProps) {
if (typeof searchParams["feedId"] === "string")
feedIdList.push(searchParams["feedId"]);

const tab =
typeof searchParams["tab"] === "string" ? searchParams["tab"] : "english";

return (
<Suspense fallback={<ScreenLoader />}>
<TrendDashboardTemplate
Expand Down
9 changes: 8 additions & 1 deletion web/client/src/app/feed/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { redirect } from "next/navigation";
import { Suspense } from "react";

import { FeedDetailTemplate } from "@/features/feeds/components/Template";
import { getUser } from "@/features/users/actions/user";

import { ScreenLoader } from "@/components/layout/ScreenLoader";

Expand All @@ -11,10 +13,15 @@ type FeedDetailPageProps = {
searchParams: { [key: string]: string | string[] | undefined };
};

export default function FeedDetailPage({
export default async function FeedDetailPage({
params,
searchParams,
}: FeedDetailPageProps) {
const user = await getUser();
if (!user) {
redirect("/login");
}

const { id } = params;
const keyword =
typeof searchParams["keyword"] === "string"
Expand Down
9 changes: 8 additions & 1 deletion web/client/src/app/feed/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { redirect } from "next/navigation";
import { Suspense } from "react";

import { FeedTemplate } from "@/features/feeds/components/Template";
import { getUser } from "@/features/users/actions/user";

import { ScreenLoader } from "@/components/layout/ScreenLoader";

Expand All @@ -9,7 +11,12 @@ type PageProps = {
searchParams: { [key: string]: string | string[] | undefined };
};

export default function FeedListPage({ searchParams }: PageProps) {
export default async function FeedListPage({ searchParams }: PageProps) {
const user = await getUser();
if (!user) {
redirect("/login");
}

const keyword =
typeof searchParams["keyword"] === "string"
? searchParams["keyword"]
Expand Down
Loading