mirror of
https://github.com/Ravinou/borgwarehouse
synced 2026-03-14 14:25:46 +01:00
refactor: ⚡ index for account and monitoring page
This commit is contained in:
parent
d7bd79b5b4
commit
67861260f8
2 changed files with 11 additions and 8 deletions
|
|
@ -2,18 +2,20 @@
|
|||
import Head from 'next/head';
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
import { useSession } from 'next-auth/react';
|
||||
import { authOptions } from '../../pages/api/auth/[...nextauth]';
|
||||
import { authOptions } from '../api/auth/[...nextauth]';
|
||||
import { getServerSession } from 'next-auth/next';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
import { SessionStatus } from '~/types/api/next-auth.types';
|
||||
|
||||
//Components
|
||||
import UserSettings from '../../Containers/UserSettings/UserSettings';
|
||||
import UserSettings from '~/Containers/UserSettings/UserSettings';
|
||||
|
||||
export default function Account() {
|
||||
////Var
|
||||
const { status, data } = useSession();
|
||||
|
||||
//Function
|
||||
if (status == 'unauthenticated' || status == 'loading') {
|
||||
if (status == 'unauthenticated' || status == 'loading' || !data) {
|
||||
return <p>Loading...</p>;
|
||||
}
|
||||
return (
|
||||
|
|
@ -22,12 +24,12 @@ export default function Account() {
|
|||
<title>Account - BorgWarehouse</title>
|
||||
</Head>
|
||||
|
||||
<UserSettings status={status} data={data} />
|
||||
<UserSettings status={status as SessionStatus} data={data} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
//Var
|
||||
const session = await getServerSession(context.req, context.res, authOptions);
|
||||
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
import Head from 'next/head';
|
||||
import { authOptions } from '../../pages/api/auth/[...nextauth]';
|
||||
import { authOptions } from '../api/auth/[...nextauth]';
|
||||
import { getServerSession } from 'next-auth/next';
|
||||
import { GetServerSidePropsContext } from 'next';
|
||||
|
||||
//Components
|
||||
import StorageUsedChartBar from '../../Containers/Monitoring/StorageUsedChartBar/StorageUsedChartBar';
|
||||
import StorageUsedChartBar from '~/Containers/Monitoring/StorageUsedChartBar/StorageUsedChartBar';
|
||||
|
||||
export default function Monitoring() {
|
||||
return (
|
||||
|
|
@ -45,7 +46,7 @@ export default function Monitoring() {
|
|||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
//Var
|
||||
const session = await getServerSession(context.req, context.res, authOptions);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue