From 635e9203dd9089ecb01d132f502c666794a63df6 Mon Sep 17 00:00:00 2001 From: DuncanRitchie Date: Wed, 4 Dec 2024 17:35:14 +0000 Subject: [PATCH] Deleted unused func & export (found by Knip) --- components/lemma/Lemma.jsx | 2 +- lib/lemmata/count.js | 18 +----------------- lib/words/count.js | 2 +- pages/about.js | 4 ++-- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/components/lemma/Lemma.jsx b/components/lemma/Lemma.jsx index e4ceca4..9a079ad 100644 --- a/components/lemma/Lemma.jsx +++ b/components/lemma/Lemma.jsx @@ -240,4 +240,4 @@ const Lemma = ({ lemma, linkBase, currentWordHyphenated, showFormsAndCognates = } export default Lemma -export { getLemmaId, shouldGeneratedFormsBeShownForLemma } +export { getLemmaId } diff --git a/lib/lemmata/count.js b/lib/lemmata/count.js index 54ab5ef..14a4224 100644 --- a/lib/lemmata/count.js +++ b/lib/lemmata/count.js @@ -1,7 +1,7 @@ import dbConnect from '../dbConnect' import Lemma from '../../models/Lemma' -export async function count() { +export default async function count() { try { await dbConnect() const count = await Lemma.estimatedDocumentCount() @@ -10,19 +10,3 @@ export async function count() { return { success: false } } } - -export default async function handler(req, res) { - switch (req.method) { - case 'GET': - const data = await count() - if (data.success) { - res.status(200).json(data) - } else { - res.status(400).json(data) - } - break - default: - res.status(400).json({ success: false }) - break - } -} diff --git a/lib/words/count.js b/lib/words/count.js index c81ab2f..e8ec821 100644 --- a/lib/words/count.js +++ b/lib/words/count.js @@ -1,7 +1,7 @@ import dbConnect from '../dbConnect' import Word from '../../models/Word' -export async function count() { +export default async function count() { try { await dbConnect() const count = await Word.estimatedDocumentCount() diff --git a/pages/about.js b/pages/about.js index 5e8357f..caeaf92 100644 --- a/pages/about.js +++ b/pages/about.js @@ -3,8 +3,8 @@ import Head from 'next/head' import Header from '../components/header/Header' import Search from '../components/search/Search' import superscriptLemmaTag from '../components/lemma/superscriptLemmaTag' -import { count as wordsCount } from '../lib/words/count' -import { count as lemmataCount } from '../lib/lemmata/count' +import wordsCount from '../lib/words/count' +import lemmataCount from '../lib/lemmata/count' import { getShowGeneratedFormsString } from '../lib/lemmata' import styles from '../css/About.module.css' import AboutContents from '../components/aboutContents/AboutContents'