Use server actions instead of client-side API calls
This commit is contained in:
parent
5a3127dcb0
commit
aa453954ed
30 changed files with 703 additions and 462 deletions
|
|
@ -20,11 +20,12 @@ import {
|
|||
WhatsApp as WhatsAppIcon,
|
||||
Facebook as FacebookIcon,
|
||||
AirlineStops as AirlineStopsIcon,
|
||||
Logout as LogoutIcon,
|
||||
} from "@mui/icons-material";
|
||||
import { usePathname } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import { typography, fonts } from "@link-stack/ui";
|
||||
import { typography, fonts, Button } from "@link-stack/ui";
|
||||
import LinkLogo from "@/app/_images/link-logo-small.png";
|
||||
import { useSession, signOut } from "next-auth/react";
|
||||
|
||||
|
|
@ -161,9 +162,9 @@ export const Sidebar: FC<SidebarProps> = ({ open, setOpen }) => {
|
|||
const { data: session } = useSession();
|
||||
const user = session?.user;
|
||||
|
||||
// const logout = () => {
|
||||
// signOut({ callbackUrl: "/login" });
|
||||
// };
|
||||
const logout = () => {
|
||||
signOut({ callbackUrl: "/login" });
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
|
|
@ -377,18 +378,20 @@ export const Sidebar: FC<SidebarProps> = ({ open, setOpen }) => {
|
|||
</Box>
|
||||
</Grid>
|
||||
)}
|
||||
{open && (
|
||||
<Grid item>
|
||||
<Box
|
||||
sx={{
|
||||
...bodyLarge,
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
{user?.email}
|
||||
</Box>
|
||||
</Grid>
|
||||
)}
|
||||
|
||||
<Grid item>
|
||||
<Box
|
||||
sx={{
|
||||
...bodyLarge,
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
{user?.email}
|
||||
</Box>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Button text="Logout" kind="secondary" onClick={logout} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Drawer>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue