Skip to content

Commit

Permalink
Merge branch 'develop' into alex/414-bug-bash-add-alert-when-pick-is-…
Browse files Browse the repository at this point in the history
…upda
  • Loading branch information
Clue355 authored Jul 20, 2024
2 parents 1f26a02 + b7319b9 commit d739aa1
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/*.test.ts
**/*.test.tsx
**/*.test.js
**/*.test.jsx
**/*.test.jsx
next-env.d.ts
15 changes: 14 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@
"rules": {
"no-unused-vars": "off"
}
},
{
"files": ["playwright.config.ts"],
"rules": {
"no-undefined": "off"
}
},
{
"files": ["functions/userAuth.js"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
]
}
}
6 changes: 5 additions & 1 deletion context/AuthContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { DataStore } from '@/store/dataStore';
import { IUser } from '@/api/apiFunctions.interface';
import { getCurrentUser } from '@/api/apiFunctions';
import { loginAccount } from './AuthHelper';
import { usePathname } from 'next/navigation';

type UserCredentials = {
email: string;
Expand Down Expand Up @@ -43,6 +44,7 @@ export const AuthContextProvider = ({
(state) => state,
);
const router = useRouter();
const pathname = usePathname();

useEffect(() => {
if (user.id === '' || user.email === '') {
Expand Down Expand Up @@ -87,7 +89,9 @@ export const AuthContextProvider = ({
*/
const getUser = async (): Promise<IUser | undefined> => {
if (!isSessionInLocalStorage()) {
router.push('/login');
if (pathname !== '/register') {
router.push('/login');
}
return;
}

Expand Down
3 changes: 3 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import '@testing-library/jest-dom';
10 changes: 9 additions & 1 deletion middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { NextResponse, type NextRequest } from 'next/server'

export async function middleware(request: NextRequest) {
/**
* Checks if the request is a POST request and if so, returns the response object
* @param request - The request object
* @returns {NextResponse} - The response object
*/
export async function middleware(request: NextRequest): Promise<NextResponse> {
try {
return NextResponse.next({
request: {
Expand Down
6 changes: 5 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ module.exports = {
images: {
domains: ['a.espncdn.com'],
},
}
eslint: {
ignoreDuringBuilds: false,
dirs: ["."],
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"storybook-docs": "storybook dev --docs",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"lint": "next lint --quiet"
"lint": "npx next lint --dir ."
},
"dependencies": {
"@hookform/resolvers": "^3.3.4",
Expand Down
8 changes: 7 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import { defineConfig, devices } from '@playwright/test';
import { execSync } from 'child_process';

// Get the current branch
/**
* Get the current branch
* @returns {void}
*/
function getCurrentBranch(): string {
try {
const branch = execSync('git rev-parse --abbrev-ref HEAD')
Expand Down
3 changes: 3 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

module.exports = {
plugins: {
tailwindcss: {},
Expand Down
5 changes: 4 additions & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

module.exports = {
printWidth: 80,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
};
};
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"**/*.tsx",
".next/types/**/*.ts",
"jest.config.ts"
],
, "functions/userAuth.ts" ],
"exclude": ["node_modules"]
}
}

0 comments on commit d739aa1

Please sign in to comment.