From da976a2bb5d8efa25f8f40851b0ae82dcf52fe7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikko=20Forsstr=C3=B6m?= Date: Sun, 29 Sep 2024 12:03:12 +0300 Subject: [PATCH] Upgrades, 2024-10 --- package.json | 8 +-- pnpm-lock.yaml | 131 +++----------------------------------- src/services/audio.ts | 8 ++- src/services/comments.ts | 33 +++++++--- src/services/currency.ts | 12 ++-- src/services/instance.ts | 6 +- src/services/quarticle.ts | 22 +++---- src/services/random.ts | 5 -- src/services/video.ts | 8 ++- 9 files changed, 65 insertions(+), 168 deletions(-) delete mode 100644 src/services/random.ts diff --git a/package.json b/package.json index b3ba68d..23684ee 100644 --- a/package.json +++ b/package.json @@ -26,14 +26,12 @@ "author": "Pekkis", "license": "MIT", "dependencies": { - "@faker-js/faker": "^9.0.3", "@hookform/resolvers": "^3.9.0", "@react-three/fiber": "^8.17.8", "@tanstack/react-query": "^5.56.2", "@tanstack/react-query-devtools": "^5.58.0", "@vanilla-extract/css": "^1.15.5", "@vanilla-extract/sprinkles": "^1.6.3", - "axios": "^1.7.7", "clsx": "^2.1.1", "currency-codes": "^2.1.0", "framer-motion": "^11.9.0", @@ -42,8 +40,6 @@ "luxon": "^3.5.0", "next": "^14.2.13", "normalize.css": "^8.0.1", - "ramda": "^0.30.1", - "random-js": "^2.1.0", "react": "18.3.1", "react-dom": "^18.3.1", "react-error-boundary": "^4.0.13", @@ -54,7 +50,7 @@ "sharp": "^0.33.5", "three": "^0.169.0", "zod": "^3.23.8", - "zustand": "5.0.0-rc.2" + "zustand": "4.5.5" }, "devDependencies": { "@chromatic-com/storybook": "^2.0.2", @@ -74,7 +70,6 @@ "@testing-library/user-event": "^14.5.2", "@types/luxon": "^3.4.2", "@types/node": "^22.7.4", - "@types/ramda": "^0.30.2", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", "@types/three": "^0.169.0", @@ -83,7 +78,6 @@ "@vanilla-extract/next-plugin": "^2.4.5", "@vanilla-extract/webpack-plugin": "^2.3.13", "@vitejs/plugin-react": "^4.3.1", - "autoprefixer": "^10.4.20", "css-loader": "^7.1.2", "eslint": "^8.57.1", "eslint-config-next": "^14.2.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 27876cf..5abd329 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - '@faker-js/faker': - specifier: ^9.0.3 - version: 9.0.3 '@hookform/resolvers': specifier: ^3.9.0 version: 3.9.0(react-hook-form@7.53.0(react@18.3.1)) @@ -29,9 +26,6 @@ importers: '@vanilla-extract/sprinkles': specifier: ^1.6.3 version: 1.6.3(@vanilla-extract/css@1.15.5) - axios: - specifier: ^1.7.7 - version: 1.7.7 clsx: specifier: ^2.1.1 version: 2.1.1 @@ -56,12 +50,6 @@ importers: normalize.css: specifier: ^8.0.1 version: 8.0.1 - ramda: - specifier: ^0.30.1 - version: 0.30.1 - random-js: - specifier: ^2.1.0 - version: 2.1.0 react: specifier: 18.3.1 version: 18.3.1 @@ -93,8 +81,8 @@ importers: specifier: ^3.23.8 version: 3.23.8 zustand: - specifier: 5.0.0-rc.2 - version: 5.0.0-rc.2(@types/react@18.3.10)(immer@10.1.1)(react@18.3.1)(use-sync-external-store@1.2.2(react@18.3.1)) + specifier: 4.5.5 + version: 4.5.5(@types/react@18.3.10)(immer@10.1.1)(react@18.3.1) devDependencies: '@chromatic-com/storybook': specifier: ^2.0.2 @@ -147,9 +135,6 @@ importers: '@types/node': specifier: ^22.7.4 version: 22.7.4 - '@types/ramda': - specifier: ^0.30.2 - version: 0.30.2 '@types/react': specifier: ^18.3.10 version: 18.3.10 @@ -174,9 +159,6 @@ importers: '@vitejs/plugin-react': specifier: ^4.3.1 version: 4.3.1(vite@5.4.8(@types/node@22.7.4)(terser@5.34.0)) - autoprefixer: - specifier: ^10.4.20 - version: 10.4.20(postcss@8.4.47) css-loader: specifier: ^7.1.2 version: 7.1.2(webpack@5.95.0(esbuild@0.23.1)) @@ -1284,10 +1266,6 @@ packages: resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@faker-js/faker@9.0.3': - resolution: {integrity: sha512-lWrrK4QNlFSU+13PL9jMbMKLJYXDFu3tQfayBsMXX7KL/GiQeqfB1CzHkqD5UHBUtPAuPo6XwGbMFNdVMZObRA==} - engines: {node: '>=18.0.0', npm: '>=9.0.0'} - '@hookform/resolvers@3.9.0': resolution: {integrity: sha512-bU0Gr4EepJ/EQsH/IwEzYLsT/PEj5C0ynLQ4m+GSHS+xKH4TfSelhluTgOaoc4kA5s7eCsQbM4wvZLzELmWzUg==} peerDependencies: @@ -2096,9 +2074,6 @@ packages: '@types/qs@6.9.16': resolution: {integrity: sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A==} - '@types/ramda@0.30.2': - resolution: {integrity: sha512-PyzHvjCalm2BRYjAU6nIB3TprYwMNOUY/7P/N8bSzp9W/yM2YrtGtAnnVtaCNSeOZ8DzKyFDvaqQs7LnWwwmBA==} - '@types/range-parser@1.2.7': resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==} @@ -2555,13 +2530,6 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - autoprefixer@10.4.20: - resolution: {integrity: sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==} - engines: {node: ^10 || ^12 || >=14} - hasBin: true - peerDependencies: - postcss: ^8.1.0 - available-typed-arrays@1.0.7: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} @@ -2570,9 +2538,6 @@ packages: resolution: {integrity: sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g==} engines: {node: '>=4'} - axios@1.7.7: - resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} - axobject-query@4.1.0: resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} @@ -3544,15 +3509,6 @@ packages: flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} - follow-redirects@1.15.9: - resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -3575,9 +3531,6 @@ packages: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} - fraction.js@4.3.7: - resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} - framer-motion@11.9.0: resolution: {integrity: sha512-nCfGxvsQecVLjjYDu35G2F5ls+ArE3FBfhxV0RSiisMaUKqteq5DMBFNRKwMyVj+VqKTNhawt+BV480YCHKFlQ==} peerDependencies: @@ -4534,10 +4487,6 @@ packages: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} - normalize-range@0.1.2: - resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} - engines: {node: '>=0.10.0'} - normalize.css@8.0.1: resolution: {integrity: sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==} @@ -4858,9 +4807,6 @@ packages: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} - proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} @@ -4891,12 +4837,6 @@ packages: queue@6.0.2: resolution: {integrity: sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==} - ramda@0.30.1: - resolution: {integrity: sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw==} - - random-js@2.1.0: - resolution: {integrity: sha512-CRUyWmnzmZBA7RZSVGq0xMqmgCyPPxbiKNLFA5ud7KenojVX2s7Gv+V7eB52beKTPGxWRnVZ7D/tCIgYJJ8vNQ==} - randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -5602,9 +5542,6 @@ packages: typescript: optional: true - ts-toolbelt@9.6.0: - resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} - tsconfig-paths-webpack-plugin@4.1.0: resolution: {integrity: sha512-xWFISjviPydmtmgeUAuXp4N1fky+VCtfhOkDUFIv5ea7p4wuTomI4QTrXvFBX2S4jZsmyTSrStQl+E+4w+RzxA==} engines: {node: '>=10.13.0'} @@ -5674,9 +5611,6 @@ packages: resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} engines: {node: '>= 0.4'} - types-ramda@0.30.1: - resolution: {integrity: sha512-1HTsf5/QVRmLzcGfldPFvkVsAdi1db1BBKzi7iW3KBUlOICg/nKnFS+jGqDJS3YD8VsWbAh7JiHeBvbsw8RPxA==} - typescript@5.6.2: resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} engines: {node: '>=14.17'} @@ -6051,14 +5985,13 @@ packages: react: optional: true - zustand@5.0.0-rc.2: - resolution: {integrity: sha512-o2Nwuvnk8vQBX7CcHL8WfFkZNJdxB/VKeWw0tNglw8p4cypsZ3tRT7rTRTDNeUPFS0qaMBRSKe+fVwL5xpcE3A==} - engines: {node: '>=12.20.0'} + zustand@4.5.5: + resolution: {integrity: sha512-+0PALYNJNgK6hldkgDq2vLrw5f6g/jCInz52n9RTpropGgeAf/ioFUCdtsjCqu4gNhW9D01rUQBROoRjdzyn2Q==} + engines: {node: '>=12.7.0'} peerDependencies: - '@types/react': '>=18.0.0' + '@types/react': '>=16.8' immer: '>=9.0.6' - react: '>=18.0.0' - use-sync-external-store: '>=1.2.0' + react: '>=16.8' peerDependenciesMeta: '@types/react': optional: true @@ -6066,8 +5999,6 @@ packages: optional: true react: optional: true - use-sync-external-store: - optional: true zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -7159,8 +7090,6 @@ snapshots: '@eslint/js@8.57.1': {} - '@faker-js/faker@9.0.3': {} - '@hookform/resolvers@3.9.0(react-hook-form@7.53.0(react@18.3.1))': dependencies: react-hook-form: 7.53.0(react@18.3.1) @@ -8079,10 +8008,6 @@ snapshots: '@types/qs@6.9.16': {} - '@types/ramda@0.30.2': - dependencies: - types-ramda: 0.30.1 - '@types/range-parser@1.2.7': {} '@types/react-dom@18.3.0': @@ -8718,30 +8643,12 @@ snapshots: asynckit@0.4.0: {} - autoprefixer@10.4.20(postcss@8.4.47): - dependencies: - browserslist: 4.24.0 - caniuse-lite: 1.0.30001664 - fraction.js: 4.3.7 - normalize-range: 0.1.2 - picocolors: 1.1.0 - postcss: 8.4.47 - postcss-value-parser: 4.2.0 - available-typed-arrays@1.0.7: dependencies: possible-typed-array-names: 1.0.0 axe-core@4.10.0: {} - axios@1.7.7: - dependencies: - follow-redirects: 1.15.9 - form-data: 4.0.0 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - axobject-query@4.1.0: {} babel-loader@9.2.1(@babel/core@7.25.2)(webpack@5.95.0(esbuild@0.23.1)): @@ -9977,8 +9884,6 @@ snapshots: flatted@3.3.1: {} - follow-redirects@1.15.9: {} - for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -10013,8 +9918,6 @@ snapshots: forwarded@0.2.0: {} - fraction.js@4.3.7: {} - framer-motion@11.9.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: tslib: 2.7.0 @@ -11109,8 +11012,6 @@ snapshots: normalize-path@3.0.0: {} - normalize-range@0.1.2: {} - normalize.css@8.0.1: {} nth-check@2.1.1: @@ -11436,8 +11337,6 @@ snapshots: forwarded: 0.2.0 ipaddr.js: 1.9.1 - proxy-from-env@1.1.0: {} - psl@1.9.0: {} public-encrypt@4.0.3: @@ -11467,10 +11366,6 @@ snapshots: dependencies: inherits: 2.0.4 - ramda@0.30.1: {} - - random-js@2.1.0: {} - randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 @@ -12315,8 +12210,6 @@ snapshots: optionalDependencies: typescript: 5.6.2 - ts-toolbelt@9.6.0: {} - tsconfig-paths-webpack-plugin@4.1.0: dependencies: chalk: 4.1.2 @@ -12398,10 +12291,6 @@ snapshots: is-typed-array: 1.1.13 possible-typed-array-names: 1.0.0 - types-ramda@0.30.1: - dependencies: - ts-toolbelt: 9.6.0 - typescript@5.6.2: {} ufo@1.5.4: {} @@ -12495,7 +12384,6 @@ snapshots: use-sync-external-store@1.2.2(react@18.3.1): dependencies: react: 18.3.1 - optional: true util-deprecate@1.0.2: {} @@ -12816,11 +12704,12 @@ snapshots: optionalDependencies: react: 18.3.1 - zustand@5.0.0-rc.2(@types/react@18.3.10)(immer@10.1.1)(react@18.3.1)(use-sync-external-store@1.2.2(react@18.3.1)): + zustand@4.5.5(@types/react@18.3.10)(immer@10.1.1)(react@18.3.1): + dependencies: + use-sync-external-store: 1.2.2(react@18.3.1) optionalDependencies: '@types/react': 18.3.10 immer: 10.1.1 react: 18.3.1 - use-sync-external-store: 1.2.2(react@18.3.1) zwitch@2.0.4: {} diff --git a/src/services/audio.ts b/src/services/audio.ts index 7e0b505..5bcee4b 100644 --- a/src/services/audio.ts +++ b/src/services/audio.ts @@ -1,5 +1,5 @@ -import axios from "axios"; import { getBaseUrl } from "./instance"; +import ky from "ky"; export type QuackCastAudio = { title: string; @@ -9,6 +9,8 @@ export type QuackCastAudio = { }; export const getQuackCast = async (): Promise => { - const ret = await axios.get(`${getBaseUrl()}/audio`); - return ret.data; + const ret = await ky.get(`${getBaseUrl()}/audio`, { + retry: 0 + }); + return ret.json(); }; diff --git a/src/services/comments.ts b/src/services/comments.ts index bc044f8..f3464df 100644 --- a/src/services/comments.ts +++ b/src/services/comments.ts @@ -1,28 +1,43 @@ -import axios from "axios"; import { getBaseUrl } from "./instance"; -export type NewCommentType = unknown; +import { z } from "zod"; +import ky from "ky"; -export type CommentType = unknown; +export const commentSchema = z.object({ + comment: z.string().min(10), + email: z.string().email() +}); + +export type NewCommentType = z.infer; + +export type CommentType = NewCommentType & { + id: string; + publishedAt: string; +}; export const postComment = async ( quarticleId: string, comment: NewCommentType ): Promise => { - const ret = await axios.post( + const ret = await ky.post( `${getBaseUrl()}/quarticle/${quarticleId}/comment`, - comment + { + json: comment + } ); - return ret.data; + return ret.json(); }; export const getComments = async ( quarticleId: string ): Promise => { - const ret = await axios.get( - `${getBaseUrl()}/quarticle/${quarticleId}/comment` + const ret = await ky.get( + `${getBaseUrl()}/quarticle/${quarticleId}/comment`, + { + retry: 0 + } ); - return ret.data; + return ret.json(); }; diff --git a/src/services/currency.ts b/src/services/currency.ts index 00669ef..222dbd5 100644 --- a/src/services/currency.ts +++ b/src/services/currency.ts @@ -1,4 +1,4 @@ -import axios from "axios"; +import ky from "ky"; import { getBaseUrl } from "./instance"; import cc from "currency-codes"; @@ -24,11 +24,13 @@ export const getCurrencyRates = async ( date: string ): Promise => { try { - const ret = await axios.get( - `${getBaseUrl()}/currency/${date}` + const ret = await ky.get( + `${getBaseUrl()}/currency/${date}`, + { + retry: 0 + } ); - - const currencyRates = ret.data; + const currencyRates = await ret.json(); const enriched: EnrichedCurrencyRates = { ...currencyRates, diff --git a/src/services/instance.ts b/src/services/instance.ts index 963a5ab..be4f147 100644 --- a/src/services/instance.ts +++ b/src/services/instance.ts @@ -1,4 +1,4 @@ -import axios from "axios"; +import ky from "ky"; export const getAppId = (): string => { const predefinedAppId = process.env.NEXT_PUBLIC_APPID; @@ -14,9 +14,9 @@ export const getBaseUrl = (): string => `${process.env.NEXT_PUBLIC_API}/${getAppId()}`; export const cleanse = async (): Promise => { - const ret = await axios.post<{ purged: boolean }>(`${getBaseUrl()}/cleanse`, { + const ret = await ky.post<{ purged: boolean }>(`${getBaseUrl()}/cleanse`, { method: "POST" }); - return ret.data.purged; + return (await ret.json()).purged; }; diff --git a/src/services/quarticle.ts b/src/services/quarticle.ts index 08792f0..d8c09a3 100644 --- a/src/services/quarticle.ts +++ b/src/services/quarticle.ts @@ -1,4 +1,4 @@ -import axios from "axios"; +import ky from "ky"; import { getBaseUrl } from "./instance"; export type MarkdownBlockType = { @@ -79,19 +79,17 @@ export const getQuarticles = async ( offset = 0, limit = 0 ): Promise => { - const ret = await axios.get( - `${getBaseUrl()}/quarticle`, - { - params: { - offset, - limit - } + const ret = await ky.get(`${getBaseUrl()}/quarticle`, { + retry: 0, + searchParams: { + offset, + limit } - ); - return ret.data; + }); + return ret.json(); }; export const getQuarticle = async (id: string): Promise => { - const ret = await axios.get(`${getBaseUrl()}/quarticle/${id}`); - return ret.data; + const ret = await ky.get(`${getBaseUrl()}/quarticle/${id}`); + return ret.json(); }; diff --git a/src/services/random.ts b/src/services/random.ts deleted file mode 100644 index 9404c95..0000000 --- a/src/services/random.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Random, browserCrypto, nodeCrypto } from "random-js"; - -export const random = new Random( - process.env.NODE_ENV === "test" ? nodeCrypto : browserCrypto -); diff --git a/src/services/video.ts b/src/services/video.ts index 6bd185e..8526e8d 100644 --- a/src/services/video.ts +++ b/src/services/video.ts @@ -1,4 +1,4 @@ -import axios from "axios"; +import ky from "ky"; import { getBaseUrl } from "./instance"; export type QuackTubeVideo = { @@ -10,6 +10,8 @@ export type QuackTubeVideo = { }; export const getVideos = async (): Promise => { - const ret = await axios.get(`${getBaseUrl()}/video`); - return ret.data; + const ret = await ky.get(`${getBaseUrl()}/video`, { + retry: 0 + }); + return ret.json(); };