Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dilantha-Wijesinghe committed May 21, 2024
2 parents 651fe37 + 0fffc04 commit 6def43b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 87 deletions.
32 changes: 16 additions & 16 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/env sh
# #!/usr/bin/env sh

PKG_MGRS="pnpm yarn npm"
NODE_GLOBALS="node bun $PKG_MGRS npx"
# PKG_MGRS="pnpm yarn npm"
# NODE_GLOBALS="node bun $PKG_MGRS npx"

NVM_DIR="$HOME/.nvm"
# NVM_DIR="$HOME/.nvm"

if [ -d "$NVM_DIR" ]; then
_load_nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# if [ -d "$NVM_DIR" ]; then
# _load_nvm() {
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

node --version >/dev/null
npx --version >/dev/null
}
# node --version >/dev/null
# npx --version >/dev/null
# }

for cmd in $NODE_GLOBALS; do
eval "$cmd(){ unset -f $NODE_GLOBALS; _load_nvm; unset -f _load_nvm; $cmd \$@; }"
done
# for cmd in $NODE_GLOBALS; do
# eval "$cmd(){ unset -f $NODE_GLOBALS; _load_nvm; unset -f _load_nvm; $cmd \$@; }"
# done

unset -f "$NODE_GLOBALS"
fi
# unset -f "$NODE_GLOBALS"
# fi

npx --no-install commitlint --edit "$1"
# npx --no-install commitlint --edit "$1"
48 changes: 24 additions & 24 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#!/usr/bin/env sh
# #!/usr/bin/env sh

PKG_MGRS="pnpm yarn npm"
NODE_GLOBALS="node bun $PKG_MGRS npx"
# PKG_MGRS="pnpm yarn npm"
# NODE_GLOBALS="node bun $PKG_MGRS npx"

NVM_DIR="$HOME/.nvm"
# NVM_DIR="$HOME/.nvm"

if [ -d "$NVM_DIR" ]; then
_load_nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# if [ -d "$NVM_DIR" ]; then
# _load_nvm() {
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

node --version >/dev/null
npx --version >/dev/null
}
# node --version >/dev/null
# npx --version >/dev/null
# }

for cmd in $NODE_GLOBALS; do
eval "$cmd(){ unset -f $NODE_GLOBALS; _load_nvm; unset -f _load_nvm; $cmd \$@; }"
done
# for cmd in $NODE_GLOBALS; do
# eval "$cmd(){ unset -f $NODE_GLOBALS; _load_nvm; unset -f _load_nvm; $cmd \$@; }"
# done

unset -f "$NODE_GLOBALS"
fi
# unset -f "$NODE_GLOBALS"
# fi

RUNNERS="prettier build"
for pm in $PKG_MGRS; do
if command -v "$pm" >/dev/null; then
for X in $RUNNERS; do
eval "$pm run $X"
done
break
fi
done
# RUNNERS="prettier build"
# for pm in $PKG_MGRS; do
# if command -v "$pm" >/dev/null; then
# for X in $RUNNERS; do
# eval "$pm run $X"
# done
# break
# fi
# done
5 changes: 0 additions & 5 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ const nextConfig = {
destination: "/",
permanent: false,
},
{
source: "/register",
destination: "/",
permanent: false,
},
];
},
};
Expand Down
42 changes: 20 additions & 22 deletions src/api/puzzle/puzzleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,28 @@ const BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL;
axios.defaults.baseURL = BASE_URL;
axios.defaults.withCredentials = true;

export const getCrosswordDetails = (): Promise<AxiosResponse | undefined> => {
return axios
.get(GET_CROSSWORD_DETAILS)
.then((response: AxiosResponse) => {
return response;
})
.catch((error: any) => {
if (axios.isAxiosError(error)) {
return error.response;
}
});
export const getCrosswordDetails = async (): Promise<AxiosResponse | undefined> => {
try {
const response = await axios
.get(GET_CROSSWORD_DETAILS);
return response;
} catch (error) {
if (axios.isAxiosError(error)) {
return error.response;
}
}
};

export const updateCrossword = (
export const updateCrossword = async (
crossword: any,
): Promise<AxiosResponse | undefined> => {
return axios
.put(UPDATE_CROSSWORD, crossword)
.then((response: AxiosResponse) => {
return response;
})
.catch((error: any) => {
if (axios.isAxiosError(error)) {
return error.response;
}
});
try {
const response = await axios
.put(UPDATE_CROSSWORD, crossword);
return response;
} catch (error) {
if (axios.isAxiosError(error)) {
return error.response;
}
}
};
14 changes: 0 additions & 14 deletions src/components/login/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { useState } from "react";

import Link from "next/link";
import { useRouter } from "next/navigation";

import { loginTeam } from "@/api/auth/authApi";
Expand Down Expand Up @@ -110,19 +109,6 @@ export default function LoginForm() {
)}
</div>

<div className="my-9 flex px-3 text-[#5A270B]">
<center>
<h1 className="text-2xl">
Forget password?{" "}
<Link
href="/"
className="cursor-pointer underline transition duration-200 hover:text-[#A66224] active:text-[#A66224] "
>
Get a new one
</Link>
</h1>
</center>
</div>
<Button
className="mt-5 "
onClick={handleLogin}
Expand Down
10 changes: 4 additions & 6 deletions src/components/puzzle/Rows/Puzzle.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useEffect } from "react";
import { useDispatch } from "react-redux";
import { useSelector } from "react-redux";

import { useSearchParams } from "next/navigation";

import { useDispatch,useSelector } from "react-redux";
import { RootState } from "@/store";
import { setPuzzleDialog } from "@/store/reducers/puzzleDialog-reducer";
import { getCellCount } from "@/data/puzzle/ClueCellCount";

import { useSearchParams } from "next/navigation";

import {
RowFive,
Expand All @@ -22,7 +21,6 @@ import {
RowTen,
} from "@/components/puzzle/Rows/6-10";

import { getCellCount } from "@/data/puzzle/ClueCellCount";

import {
RowEleven,
Expand Down

0 comments on commit 6def43b

Please sign in to comment.