diff --git a/apps/dumili/src/composables/useDumiliSocket.ts b/apps/dumili/src/composables/useDumiliSocket.ts index b83964f4f..a4a8e393b 100644 --- a/apps/dumili/src/composables/useDumiliSocket.ts +++ b/apps/dumili/src/composables/useDumiliSocket.ts @@ -10,7 +10,6 @@ import EdgeCreatorServices from "~dm-services/edgecreator/types"; import EdgesServices from "~dm-services/edges/types"; import EventsServices from "~dm-services/events/types"; import GlobalStatsServices from "~dm-services/global-stats/types"; -import LoginServices from "~dm-services/login/types"; import PresentationTextServices from "~dm-services/presentation-text/types"; import PublicCollectionServices from "~dm-services/public-collection/types"; import StatsServices from "~dm-services/stats/types"; @@ -49,10 +48,6 @@ const defaultExport = (options: { publicCollection: socket.addNamespace( PublicCollectionServices.namespaceEndpoint, ), - login: socket.addNamespace( - LoginServices.namespaceEndpoint, - {}, - ), bookcase: socket.addNamespace( BookcaseServices.namespaceEndpoint, diff --git a/apps/web/src/composables/useDmSocket.ts b/apps/web/src/composables/useDmSocket.ts index 5bac1752a..8c0f2c887 100644 --- a/apps/web/src/composables/useDmSocket.ts +++ b/apps/web/src/composables/useDmSocket.ts @@ -11,7 +11,6 @@ import EdgeCreatorServices from "~dm-services/edgecreator/types"; import EdgesServices from "~dm-services/edges/types"; import EventsServices from "~dm-services/events/types"; import GlobalStatsServices from "~dm-services/global-stats/types"; -import LoginServices from "~dm-services/login/types"; import PresentationTextServices from "~dm-services/presentation-text/types"; import PublicCollectionServices from "~dm-services/public-collection/types"; import StatsServices from "~dm-services/stats/types"; @@ -62,7 +61,6 @@ const defaultExport = ( PublicCollectionServices.namespaceEndpoint, ), app: socket.addNamespace(AppServices.namespaceEndpoint), - login: socket.addNamespace(LoginServices.namespaceEndpoint), bookcase: socket.addNamespace( BookcaseServices.namespaceEndpoint, @@ -115,10 +113,11 @@ const defaultExport = ( CollectionServices.namespaceEndpoint, { session, - cache: { - storage: cacheStorage, - ttl: 1000, // 1 second only, because we want to always get the latest data but still cache in case of offline - }, + // TODO cache is wrongly done on all endpoints if uncommented, it should be done only on retrieval endpoints + // cache: { + // storage: cacheStorage, + // ttl: 1000, // 1 second only, because we want to always get the latest data but still cache in case of offline + // }, }, ), coverId: socket.addNamespace( diff --git a/apps/web/src/pages/demo.vue b/apps/web/src/pages/demo.vue index c7085a8ab..7eda56e5f 100644 --- a/apps/web/src/pages/demo.vue +++ b/apps/web/src/pages/demo.vue @@ -14,7 +14,7 @@ const { user } = storeToRefs(collection()); const router = useRouter(); const { - login: { services: loginServices }, + auth: { services: authServices }, } = inject(socketInjectionKey)!; watch( @@ -28,7 +28,7 @@ watch( ); (async () => { - const result = await loginServices.loginAsDemo(); + const result = await authServices.loginAsDemo(); switch (result.error) { case "No demo user found": console.error(result.error); diff --git a/apps/web/src/pages/signup.vue b/apps/web/src/pages/signup.vue index c180df428..e93701e81 100644 --- a/apps/web/src/pages/signup.vue +++ b/apps/web/src/pages/signup.vue @@ -68,7 +68,7 @@ import Cookies from "js-cookie"; import type { ScopedError } from "~socket.io-services/types"; -const { signup: userSignup, loadUser } = collection(); +const { loadUser } = collection(); const { user } = storeToRefs(collection()); const router = useRouter(); diff --git a/apps/web/src/stores/collection.ts b/apps/web/src/stores/collection.ts index 96a5cc12a..4ccea5444 100644 --- a/apps/web/src/stores/collection.ts +++ b/apps/web/src/stores/collection.ts @@ -12,7 +12,7 @@ import type { purchase, subscription, } from "~prisma-schemas/schemas/dm"; -import type { EventReturnType, ScopedError } from "~socket.io-services/types"; +import type { EventReturnType } from "~socket.io-services/types"; import useCollection from "../composables/useCollection"; import { socketInjectionKey } from "../composables/useDmSocket"; @@ -41,7 +41,7 @@ export const collection = defineStore("collection", () => { const { collection: { services: collectionServices }, stats: { services: statsServices }, - login: { services: loginServices }, + auth: { services: authServices }, options: socketOptions, } = inject(socketInjectionKey)!; @@ -52,8 +52,8 @@ export const collection = defineStore("collection", () => { >(null); const collectionUtils = useCollection( - issues as ShallowRef<(issue & { issuecode: string })[]>, - ), + issues as ShallowRef<(issue & { issuecode: string })[]>, + ), watchedPublicationsWithSales = shallowRef(null), purchases = shallowRef(null), watchedAuthors = shallowRef(null), @@ -81,8 +81,8 @@ export const collection = defineStore("collection", () => { >(null), coaIssueCountsByPublicationcode = shallowRef< | EventReturnType< - CollectionServices["getIssues"] - >["countByPublicationcode"] + CollectionServices["getIssues"] + >["countByPublicationcode"] | null >(null), user = shallowRef< @@ -120,7 +120,7 @@ export const collection = defineStore("collection", () => { ([publicationcode1], [publicationcode2]) => Math.sign( totalPerPublicationUniqueIssuecodes.value[publicationcode2]! - - totalPerPublicationUniqueIssuecodes.value[publicationcode1]!, + totalPerPublicationUniqueIssuecodes.value[publicationcode1]!, ), ), ), @@ -312,7 +312,7 @@ export const collection = defineStore("collection", () => { onSuccess: (token: string) => void, onError: (e: string) => void, ) => { - const response = await loginServices.login({ + const response = await authServices.login({ username, password, }); @@ -322,30 +322,6 @@ export const collection = defineStore("collection", () => { onSuccess(response as string); } }, - signup = async ( - username: string, - password: string, - password2: string, - email: string, - onSuccess: (token: string) => void, - onError: (e: ScopedError) => void, - ) => { - const response = await collectionServices.createUser({ - username, - password, - password2, - email, - }); - if (response.error) { - if (response.selector) { - onError(response); - } else { - console.error(response.error, response.errorDetails); - } - } else { - onSuccess(response.token); - } - }, loadUser = async (afterUpdate = false) => { if (!isLoadingUser.value && (afterUpdate || !user.value)) { isLoadingUser.value = true; @@ -371,7 +347,7 @@ export const collection = defineStore("collection", () => { console.log(issues.value); return { ...collectionUtils, - loginServices, + authServices, issues, publicationUrlRoot, createPurchase, @@ -404,7 +380,6 @@ export const collection = defineStore("collection", () => { previousVisit, purchases, purchasesById, - signup, subscriptions, suggestions, totalPerPublicationUniqueIssuecodes, diff --git a/apps/whattheduck/.env b/apps/whattheduck/.env index c5785c077..dd6840d52 100644 --- a/apps/whattheduck/.env +++ b/apps/whattheduck/.env @@ -1,8 +1,8 @@ BASE_URL=http://localhost:8003 -VITE_DM_SOCKET_URL=https://api-websocket.ducksmanager.net +#VITE_DM_SOCKET_URL=https://api-websocket.ducksmanager.net -#VITE_DM_SOCKET_URL=http://localhost:3000 +VITE_DM_SOCKET_URL=http://localhost:3000 VITE_DISCORD_URL=https://discord.gg/ruk3FsD VITE_DM_URL=https://ducksmanager.net diff --git a/apps/whattheduck/package.json b/apps/whattheduck/package.json index f3678a914..62afb4677 100644 --- a/apps/whattheduck/package.json +++ b/apps/whattheduck/package.json @@ -80,6 +80,7 @@ "concurrently": "^9.0.1", "eslint": "^9.12.0", "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-i18next": "^6.1.0", "eslint-plugin-prettier-vue": "^5.0.0", "eslint-plugin-simple-import-sort": "^12.1.1", diff --git a/apps/whattheduck/src/App.vue b/apps/whattheduck/src/App.vue index 0641569a7..3cca1ee6c 100644 --- a/apps/whattheduck/src/App.vue +++ b/apps/whattheduck/src/App.vue @@ -4,7 +4,7 @@ {{ t('Chargement…') }} - - {{ t('Cette liste est vide.') }} - - - - - - - - -
+ + + + + - {{ getItemTextFn(itemInCenterOfViewport) }} -
+ + + + + + + +
+ {{ getItemTextFn(itemInCenterOfViewport) }} +
+