Skip to content

Commit

Permalink
hotfix: error build
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe-997 committed Jul 29, 2024
1 parent 2654cb4 commit 4d1add4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
15 changes: 9 additions & 6 deletions app/components/Header/account.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
"use client";
import { useState } from "react";
import Link from "next/link";
import { useEffect, useState } from "react";
import { Avatar, Button, Dropdown, Modal } from "antd";
import type { MenuProps } from "antd";
import { UserOutlined } from "@ant-design/icons";

import { PATHS } from "@/app/utils/path";
import { getLocalStorage } from "@/app/libs";
import LoginFormAdmin from "../Sections/loginFormAdmin";
import RegisterForm from "../Sections/registerForm";

const Account = () => {
const userInfo = getLocalStorage("user");
const [useJson, setUserJson] = useState<any>({});
const [openLoginForm, setOpenLoginForm] = useState<boolean>(false);
const [isRegister, setIsRegister] = useState<boolean>(false);
const items: MenuProps["items"] = [
Expand Down Expand Up @@ -41,9 +39,14 @@ const Account = () => {
},
];

useEffect(() => {
const userInfo = getLocalStorage("user");
if (userInfo) setUserJson(JSON.parse(userInfo));
}, []);

return (
<div>
{userInfo ? (
{useJson ? (
<Dropdown
menu={{ items }}
placement="bottomRight"
Expand Down Expand Up @@ -82,7 +85,7 @@ const Account = () => {
<>
<LoginFormAdmin />
<div className="text-center">
<span className="mr-1">Don't have an account?</span>
<span className="mr-1">Don&apos;t have an account?</span>
<Button
type="link"
className="p-0"
Expand Down
4 changes: 3 additions & 1 deletion app/libs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ export const copyButton = (label: string, value: string) => {

export const getLocalStorage = (key: string) => {
const localItem = localStorage.getItem(key);
return localItem;

if (localItem) return localItem;
else return null;
};
46 changes: 23 additions & 23 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
appDir: true,
},
images: {
domains: [
"avatars.githubusercontent.com",
"lh3.googleusercontent.com",
"res.cloudinary.com"
]
},
output: 'export',
// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,
// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
// skipTrailingSlashRedirect: true,
// Optional: Change the output directory `out` -> `dist`
// distDir: 'dist',
}
module.exports = nextConfig
experimental: {
// appDir: true,
},
images: {
domains: [
"avatars.githubusercontent.com",
"lh3.googleusercontent.com",
"res.cloudinary.com",
],
},
// output: 'export',

// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,

// Optional: Prevent automatic `/me` -> `/me/`, instead preserve `href`
// skipTrailingSlashRedirect: true,

// Optional: Change the output directory `out` -> `dist`
// distDir: 'dist',
};

module.exports = nextConfig;

0 comments on commit 4d1add4

Please sign in to comment.