chore: Linter issues
This commit is contained in:
parent
2512765c49
commit
cad7ccf294
35 changed files with 63 additions and 99 deletions
|
@ -29,7 +29,7 @@ BookmarksController.prototype.read = async (req, res, tools) => {
|
|||
* See: https://freesewing.dev/reference/backend/api
|
||||
*/
|
||||
BookmarksController.prototype.list = async (req, res, tools) => {
|
||||
const Bookmark = new BoolmarkModel(tools)
|
||||
const Bookmark = new BookmarkModel(tools)
|
||||
const bookmarks = await Bookmark.userBookmarks(req.user.uid)
|
||||
|
||||
if (bookmarks) Bookmark.setResponse(200, 'success', { bookmarks })
|
||||
|
|
|
@ -9,7 +9,7 @@ import { decorateModel } from '../utils/model-decorator.mjs'
|
|||
* @param {tools} object - A set of tools loaded in src/index.js
|
||||
* @returns {ApikeyModel} object - The ApikeyModel
|
||||
*/
|
||||
export function ApikeyModel(tools, models) {
|
||||
export function ApikeyModel(tools) {
|
||||
/*
|
||||
* See utils/model-decorator.mjs for details
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Context
|
||||
import { LoadingContext } from 'shared/context/loading-context.mjs'
|
||||
// Hooks
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
import { useToast } from 'shared/hooks/use-toast.mjs'
|
||||
import { useState, useContext } from 'react'
|
||||
|
@ -48,8 +47,7 @@ export const SuggestLanguageForm = () => {
|
|||
const { startLoading, stopLoading } = useContext(LoadingContext)
|
||||
|
||||
// Hooks
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const toast = useToast()
|
||||
|
||||
// State
|
||||
|
|
|
@ -4,7 +4,6 @@ import translators from 'site/prebuild/translators.json'
|
|||
// Context
|
||||
import { LoadingContext } from 'shared/context/loading-context.mjs'
|
||||
// Hooks
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
import { useToast } from 'shared/hooks/use-toast.mjs'
|
||||
import { useState, useContext } from 'react'
|
||||
|
@ -28,8 +27,7 @@ export const TranslatorInvite = () => {
|
|||
|
||||
// Hooks
|
||||
const { t } = useTranslation(ns)
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const toast = useToast()
|
||||
|
||||
// State
|
||||
|
|
|
@ -135,8 +135,8 @@ export const EditCuratedSet = ({ id }) => {
|
|||
const { setModal } = useContext(ModalContext)
|
||||
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const {
|
||||
t,
|
||||
//i18n
|
||||
|
|
|
@ -122,8 +122,8 @@ export const CurateSets = () => {
|
|||
const { startLoading, stopLoading } = useContext(LoadingContext)
|
||||
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t, i18n } = useTranslation('sets', 'curate', 'toast', 'account')
|
||||
const { language } = i18n
|
||||
const toast = useToast()
|
||||
|
|
|
@ -64,7 +64,7 @@ export const SlugInput = ({ slug, setSlug, title, slugAvailable }) => {
|
|||
return (
|
||||
<input
|
||||
className={`input input-text input-bordered input-lg w-full mb-2 ${
|
||||
true || !slugAvailable || slug.length < 4 ? 'input-error' : 'input-success'
|
||||
!slugAvailable || slug.length < 4 ? 'input-error' : 'input-success'
|
||||
}`}
|
||||
value={slug}
|
||||
placeholder="Type your title here"
|
||||
|
|
|
@ -49,7 +49,7 @@ export default AccountComparePage
|
|||
export async function getStaticProps({ locale }) {
|
||||
return {
|
||||
props: {
|
||||
...(await serverSideTranslations(locale, namespaces)),
|
||||
...(await serverSideTranslations(locale, ns)),
|
||||
page: {
|
||||
locale,
|
||||
path: ['account', 'compare'],
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import dynamic from 'next/dynamic'
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
||||
import { nsMerge } from 'shared/utils.mjs'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
// Components
|
||||
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
|
||||
import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs'
|
||||
|
|
|
@ -36,7 +36,7 @@ const AccountNewsletterPage = ({ page }) => {
|
|||
const { t } = useTranslation(ns)
|
||||
|
||||
return (
|
||||
<PageWrapper {...page}>
|
||||
<PageWrapper {...page} title={t('newsletter')}>
|
||||
<DynamicAuthWrapper>
|
||||
<DynamicNewsletter title />
|
||||
</DynamicAuthWrapper>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Hooks
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
@ -26,8 +25,7 @@ const ActiveSignUpPage = () => {
|
|||
path: ['confirm', 'emailchange', confirmationId],
|
||||
}
|
||||
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
const [id, setId] = useState(false)
|
||||
|
|
|
@ -52,8 +52,8 @@ const ConfirmSignUpPage = () => {
|
|||
path: ['confirm', 'emailchange', confirmationId],
|
||||
}
|
||||
|
||||
const { token, setAccount, setToken } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { setAccount, setToken } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
const [id, setId] = useState(false)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// Hooks
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
import { useDesign } from 'shared/hooks/use-design.mjs'
|
||||
// Dependencies
|
||||
|
@ -20,8 +19,7 @@ const EditPatternPage = ({ page, id }) => {
|
|||
const [pattern, setPattern] = useState(false)
|
||||
|
||||
// Hooks
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const Design = useDesign(pattern?.design)
|
||||
|
||||
// Effect
|
||||
|
|
|
@ -289,8 +289,8 @@ export const NewApikey = ({ standalone = false }) => {
|
|||
const { startLoading, stopLoading } = useContext(LoadingContext)
|
||||
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const toast = useToast()
|
||||
|
||||
|
@ -327,8 +327,8 @@ export const Apikeys = () => {
|
|||
const { startLoading, stopLoading, loading } = useContext(LoadingContext)
|
||||
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const toast = useToast()
|
||||
const { CollapseButton, closeCollapseButton } = useCollapseButton()
|
||||
|
|
|
@ -26,8 +26,8 @@ export const Tab = ({ id, activeTab, setActiveTab, t }) => (
|
|||
|
||||
export const BioSettings = ({ title = false, welcome = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Dependencies
|
||||
import { useState, useContext } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
// Hooks
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
|
@ -13,8 +13,8 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const CompareSettings = ({ title = false, welcome = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ const Checkbox = ({ value, setter, label, children = null }) => (
|
|||
|
||||
export const ConsentSettings = ({ title = false }) => {
|
||||
// Hooks
|
||||
const { account, token, setAccount, setToken } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount, setToken } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Dependencies
|
||||
import { useState, useContext } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
// Hooks
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
|
@ -15,7 +15,7 @@ export const ns = ['account', 'status']
|
|||
export const useControlState = () => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
// State
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Dependencies
|
||||
import { useState, useContext } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
// Hooks
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { useTranslation } from 'next-i18next'
|
||||
// Hooks
|
||||
import { useState } from 'react'
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs'
|
||||
// Components
|
||||
|
@ -14,8 +13,7 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const ExportAccount = () => {
|
||||
// Hooks
|
||||
const { setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import { useBackend } from 'shared/hooks/use-backend.mjs'
|
|||
|
||||
export const ForceAccountCheck = ({ trigger = null }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token, signOut } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount, signOut } = useAccount()
|
||||
const backend = useBackend()
|
||||
|
||||
// State
|
||||
const [lastCheck, setLastCheck] = useState(Date.now())
|
||||
|
|
|
@ -14,8 +14,8 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const GithubSettings = () => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ import { SaveSettingsButton } from 'shared/components/buttons/save-settings-butt
|
|||
export const ns = ['account', 'status']
|
||||
|
||||
export const ImgSettings = ({ title = false, welcome = false }) => {
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const ImperialSettings = ({ title = false, welcome = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const { account, setAccount } = useAccount()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
// State
|
||||
|
|
|
@ -14,9 +14,9 @@ export const ns = ['account', 'locales', statusNs]
|
|||
|
||||
export const LanguageSettings = ({ title = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const { account, setAccount } = useAccount()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
// State
|
||||
|
|
|
@ -24,8 +24,8 @@ const CodeInput = ({ code, setCode, t }) => (
|
|||
|
||||
export const MfaSettings = ({ title = false, welcome = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const NewsletterSettings = ({ title = false, welcome = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { LoadingStatus, setLoadingStatus } = useLoadingStatus()
|
||||
// State
|
||||
|
|
|
@ -37,8 +37,8 @@ export const ns = ['account', 'patterns', 'toast']
|
|||
export const StandAloneNewSet = () => {
|
||||
const { t } = useTranslation(['account'])
|
||||
const toast = useToast()
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
|
||||
return (
|
||||
<div className="max-w-xl">
|
||||
|
@ -571,8 +571,8 @@ const Pattern = ({ pattern, t, account, backend, refresh }) => {
|
|||
// Component for the account/patterns page
|
||||
export const Patterns = ({ standAlone = false }) => {
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
// State
|
||||
|
|
|
@ -14,8 +14,8 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const PlatformSettings = ({ platform }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ export const ns = ['account', 'status']
|
|||
|
||||
export const ReloadAccount = ({ title = false }) => {
|
||||
// Hooks
|
||||
const { setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ export const ns = ['account', 'patterns', 'toast']
|
|||
export const StandAloneNewSet = () => {
|
||||
const { t } = useTranslation(['account'])
|
||||
const toast = useToast()
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
|
||||
return (
|
||||
<div className="max-w-xl">
|
||||
|
@ -587,31 +587,11 @@ const MeasurementsSet = ({ mset, t, account, backend, refresh }) => {
|
|||
)
|
||||
}
|
||||
|
||||
// Component for the 'new/apikey' page
|
||||
//export const NewApikey = ({ app, standAlone = false }) => {
|
||||
// const { account, token } = useAccount()
|
||||
// const backend = useBackend(token)
|
||||
// const { t } = useTranslation(ns)
|
||||
// const toast = useToast()
|
||||
//
|
||||
// const [keys, setKeys] = useState([])
|
||||
// const [generate, setGenerate] = useState(false)
|
||||
// const [added, setAdded] = useState(0)
|
||||
//
|
||||
// const oneAdded = () => setAdded(added + 1)
|
||||
//
|
||||
// return (
|
||||
// <div className="max-w-xl xl:pl-4">
|
||||
// <NewKey {...{ app, t, account, setGenerate, backend, toast, oneAdded, standAlone }} />
|
||||
// </div>
|
||||
// )
|
||||
//}
|
||||
|
||||
// Component for the account/sets page
|
||||
export const Sets = ({ title = true }) => {
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t } = useTranslation(ns)
|
||||
const toast = useToast()
|
||||
const { CollapseButton, closeCollapseButton } = useCollapseButton()
|
||||
|
|
|
@ -14,8 +14,8 @@ export const ns = ['account', 'toast']
|
|||
|
||||
export const UsernameSettings = ({ title = false, welcome = false }) => {
|
||||
// Hooks
|
||||
const { account, setAccount, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account, setAccount } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { setLoadingStatus, LoadingStatus } = useLoadingStatus()
|
||||
const { t } = useTranslation(ns)
|
||||
const [username, setUsername] = useState(account.username)
|
||||
|
|
|
@ -39,8 +39,8 @@ export const ManagePattern = ({ id = false }) => {
|
|||
const [error, setError] = useState(false)
|
||||
|
||||
// Hooks
|
||||
const { account, token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const { account } = useAccount()
|
||||
const backend = useBackend()
|
||||
const { t, i18n } = useTranslation(ns)
|
||||
const { language } = i18n
|
||||
const toast = useToast()
|
||||
|
|
|
@ -6,7 +6,6 @@ import { capitalize } from 'shared/utils.mjs'
|
|||
// Hooks
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
// Components
|
||||
import { SetCandidate, ns as setNs } from 'shared/components/sets/set-candidate.mjs'
|
||||
|
@ -18,8 +17,7 @@ export const ns = setNs
|
|||
|
||||
export const CuratedSetPicker = ({ design, language, href, clickHandler }) => {
|
||||
// Hooks
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const { t, i18n } = useTranslation('sets')
|
||||
|
||||
// State
|
||||
|
@ -119,8 +117,7 @@ export const CuratedSetPicker = ({ design, language, href, clickHandler }) => {
|
|||
|
||||
export const UserSetPicker = ({ design, t, href, clickHandler }) => {
|
||||
// Hooks
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
|
||||
// State
|
||||
const [sets, setSets] = useState({})
|
||||
|
|
|
@ -4,7 +4,6 @@ import { capitalize, shortDate } from 'shared/utils.mjs'
|
|||
import { useState, useContext } from 'react'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useAccount } from 'shared/hooks/use-account.mjs'
|
||||
import { useBackend } from 'shared/hooks/use-backend.mjs'
|
||||
import { useToast } from 'shared/hooks/use-toast.mjs'
|
||||
// Context
|
||||
|
@ -222,8 +221,7 @@ const SaveExistingPattern = ({
|
|||
export const SaveView = ({ design, settings, from = false }) => {
|
||||
// Hooks
|
||||
const { t } = useTranslation(ns)
|
||||
const { token } = useAccount()
|
||||
const backend = useBackend(token)
|
||||
const backend = useBackend()
|
||||
const router = useRouter()
|
||||
const toast = useToast()
|
||||
// Context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue