diff --git a/sites/backend/src/controllers/bookmarks.mjs b/sites/backend/src/controllers/bookmarks.mjs index e38d0b4ab8b..a127cbd57a6 100644 --- a/sites/backend/src/controllers/bookmarks.mjs +++ b/sites/backend/src/controllers/bookmarks.mjs @@ -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 }) diff --git a/sites/backend/src/models/apikey.mjs b/sites/backend/src/models/apikey.mjs index d57f0238edf..35225645ac7 100644 --- a/sites/backend/src/models/apikey.mjs +++ b/sites/backend/src/models/apikey.mjs @@ -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 */ diff --git a/sites/org/components/crowdin/suggest-language.mjs b/sites/org/components/crowdin/suggest-language.mjs index daeb2c699e2..7512d44cb91 100644 --- a/sites/org/components/crowdin/suggest-language.mjs +++ b/sites/org/components/crowdin/suggest-language.mjs @@ -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 diff --git a/sites/org/components/crowdin/translator-invite.mjs b/sites/org/components/crowdin/translator-invite.mjs index cd23fd14041..eb9ee1ab41b 100644 --- a/sites/org/components/crowdin/translator-invite.mjs +++ b/sites/org/components/crowdin/translator-invite.mjs @@ -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 diff --git a/sites/org/components/curate/sets/edit.mjs b/sites/org/components/curate/sets/edit.mjs index 3ff962a578d..19730367ecc 100644 --- a/sites/org/components/curate/sets/edit.mjs +++ b/sites/org/components/curate/sets/edit.mjs @@ -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 diff --git a/sites/org/components/curate/sets/index.mjs b/sites/org/components/curate/sets/index.mjs index 9829902f354..5e81de38df9 100644 --- a/sites/org/components/curate/sets/index.mjs +++ b/sites/org/components/curate/sets/index.mjs @@ -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() diff --git a/sites/org/components/github/inputs.mjs b/sites/org/components/github/inputs.mjs index fccd0ca9daa..b1b7d7f479f 100644 --- a/sites/org/components/github/inputs.mjs +++ b/sites/org/components/github/inputs.mjs @@ -64,7 +64,7 @@ export const SlugInput = ({ slug, setSlug, title, slugAvailable }) => { return ( { const { t } = useTranslation(ns) return ( - + diff --git a/sites/org/pages/confirm/signup-aea/[...confirmation].mjs b/sites/org/pages/confirm/signup-aea/[...confirmation].mjs index 1cf1f55b97f..bca6c54916d 100644 --- a/sites/org/pages/confirm/signup-aea/[...confirmation].mjs +++ b/sites/org/pages/confirm/signup-aea/[...confirmation].mjs @@ -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) diff --git a/sites/org/pages/confirm/signup/[...confirmation].mjs b/sites/org/pages/confirm/signup/[...confirmation].mjs index 755468559e8..74cc9d3db86 100644 --- a/sites/org/pages/confirm/signup/[...confirmation].mjs +++ b/sites/org/pages/confirm/signup/[...confirmation].mjs @@ -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) diff --git a/sites/org/pages/patterns/[id]/edit.mjs b/sites/org/pages/patterns/[id]/edit.mjs index 9750a147c91..6b899ead241 100644 --- a/sites/org/pages/patterns/[id]/edit.mjs +++ b/sites/org/pages/patterns/[id]/edit.mjs @@ -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 diff --git a/sites/shared/components/account/apikeys.mjs b/sites/shared/components/account/apikeys.mjs index ede42c930ad..f5a60c82e16 100644 --- a/sites/shared/components/account/apikeys.mjs +++ b/sites/shared/components/account/apikeys.mjs @@ -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() diff --git a/sites/shared/components/account/bio.mjs b/sites/shared/components/account/bio.mjs index a71def21dd6..37e3edf43f3 100644 --- a/sites/shared/components/account/bio.mjs +++ b/sites/shared/components/account/bio.mjs @@ -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() diff --git a/sites/shared/components/account/compare.mjs b/sites/shared/components/account/compare.mjs index 1cd9cab16ea..e4aa55d757f 100644 --- a/sites/shared/components/account/compare.mjs +++ b/sites/shared/components/account/compare.mjs @@ -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) diff --git a/sites/shared/components/account/consent.mjs b/sites/shared/components/account/consent.mjs index a21f869074b..4788979dae0 100644 --- a/sites/shared/components/account/consent.mjs +++ b/sites/shared/components/account/consent.mjs @@ -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) diff --git a/sites/shared/components/account/control.mjs b/sites/shared/components/account/control.mjs index 0dd246cc7e1..4ba2f4a8abf 100644 --- a/sites/shared/components/account/control.mjs +++ b/sites/shared/components/account/control.mjs @@ -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 diff --git a/sites/shared/components/account/email.mjs b/sites/shared/components/account/email.mjs index 8d550cc5ecd..4c3ceccebd1 100644 --- a/sites/shared/components/account/email.mjs +++ b/sites/shared/components/account/email.mjs @@ -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' diff --git a/sites/shared/components/account/export.mjs b/sites/shared/components/account/export.mjs index a3b8071cbc1..528517d268f 100644 --- a/sites/shared/components/account/export.mjs +++ b/sites/shared/components/account/export.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() diff --git a/sites/shared/components/account/force-account-check.mjs b/sites/shared/components/account/force-account-check.mjs index 6e4c5e4be2e..4e5c0bd45d6 100644 --- a/sites/shared/components/account/force-account-check.mjs +++ b/sites/shared/components/account/force-account-check.mjs @@ -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()) diff --git a/sites/shared/components/account/github.mjs b/sites/shared/components/account/github.mjs index 2a385263a73..18e1ac7f221 100644 --- a/sites/shared/components/account/github.mjs +++ b/sites/shared/components/account/github.mjs @@ -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() diff --git a/sites/shared/components/account/img.mjs b/sites/shared/components/account/img.mjs index 7e3d3db4d7a..540d94e7193 100644 --- a/sites/shared/components/account/img.mjs +++ b/sites/shared/components/account/img.mjs @@ -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) diff --git a/sites/shared/components/account/imperial.mjs b/sites/shared/components/account/imperial.mjs index 0d23d23c11d..87f0209e815 100644 --- a/sites/shared/components/account/imperial.mjs +++ b/sites/shared/components/account/imperial.mjs @@ -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 diff --git a/sites/shared/components/account/language.mjs b/sites/shared/components/account/language.mjs index 761050078d6..47ac96e4ed9 100644 --- a/sites/shared/components/account/language.mjs +++ b/sites/shared/components/account/language.mjs @@ -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 diff --git a/sites/shared/components/account/mfa.mjs b/sites/shared/components/account/mfa.mjs index 56e8c35ba54..d5082ced6c0 100644 --- a/sites/shared/components/account/mfa.mjs +++ b/sites/shared/components/account/mfa.mjs @@ -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() diff --git a/sites/shared/components/account/newsletter.mjs b/sites/shared/components/account/newsletter.mjs index 6c7e5b945fb..3801c98f84c 100644 --- a/sites/shared/components/account/newsletter.mjs +++ b/sites/shared/components/account/newsletter.mjs @@ -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 diff --git a/sites/shared/components/account/patterns.mjs b/sites/shared/components/account/patterns.mjs index 7744890eeef..d8f9fc4f3b3 100644 --- a/sites/shared/components/account/patterns.mjs +++ b/sites/shared/components/account/patterns.mjs @@ -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 (
@@ -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 diff --git a/sites/shared/components/account/platform.mjs b/sites/shared/components/account/platform.mjs index 1a3ff536148..e01d0666625 100644 --- a/sites/shared/components/account/platform.mjs +++ b/sites/shared/components/account/platform.mjs @@ -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() diff --git a/sites/shared/components/account/reload.mjs b/sites/shared/components/account/reload.mjs index 3d590274d23..32f9030564e 100644 --- a/sites/shared/components/account/reload.mjs +++ b/sites/shared/components/account/reload.mjs @@ -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() diff --git a/sites/shared/components/account/sets.mjs b/sites/shared/components/account/sets.mjs index 4e6c0615427..8645390fddd 100644 --- a/sites/shared/components/account/sets.mjs +++ b/sites/shared/components/account/sets.mjs @@ -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 (
@@ -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 ( -//
-// -//
-// ) -//} - // 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() diff --git a/sites/shared/components/account/username.mjs b/sites/shared/components/account/username.mjs index 325d7b519d4..9ea1d1ee696 100644 --- a/sites/shared/components/account/username.mjs +++ b/sites/shared/components/account/username.mjs @@ -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) diff --git a/sites/shared/components/pattern/manage.mjs b/sites/shared/components/pattern/manage.mjs index b2c55e1d964..fcb959d99b0 100644 --- a/sites/shared/components/pattern/manage.mjs +++ b/sites/shared/components/pattern/manage.mjs @@ -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() diff --git a/sites/shared/components/sets/set-picker.mjs b/sites/shared/components/sets/set-picker.mjs index c44e16aa60f..3af5f17dddf 100644 --- a/sites/shared/components/sets/set-picker.mjs +++ b/sites/shared/components/sets/set-picker.mjs @@ -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({}) diff --git a/sites/shared/components/workbench/views/save/index.mjs b/sites/shared/components/workbench/views/save/index.mjs index d61673503e6..e88dbde444b 100644 --- a/sites/shared/components/workbench/views/save/index.mjs +++ b/sites/shared/components/workbench/views/save/index.mjs @@ -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