Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Simplify use ressource store

Smaug673926f681d6a2c9
diff --git a/frontend/app/components/MarkdownEditor/modules/editorUploads.ts b/frontend/app/components/MarkdownEditor/modules/editorUploads.ts
index 9ee32982..ab54702d 100644
--- a/frontend/app/components/MarkdownEditor/modules/editorUploads.ts
+++ b/frontend/app/components/MarkdownEditor/modules/editorUploads.ts
@@ -2,7 +2,7 @@ import { EditorView } from '@codemirror/view';
import type { Node } from '~/stores';
interface UploadHandlersParams {
- resourcesStore: any;
+ resourcesStore: ReturnType<typeof import('~/stores').useRessourcesStore>;
CDN: string;
insertText: (text: string) => void;
}
diff --git a/frontend/app/stores/resources.store.ts b/frontend/app/stores/resources.store.ts
index 965b6904..7f8e862b 100644
--- a/frontend/app/stores/resources.store.ts
+++ b/frontend/app/stores/resources.store.ts
@@ -1,14 +1,7 @@
import { makeRequest } from './_utils';
import type { Node } from './db_strustures';
export const useRessourcesStore = defineStore('ressources', {
- state: () => ({
- ressources: [] as Node[],
- isFetching: false,
- }),
- getters: {
- getAll: state => state.ressources,
- getById: state => (id: string) => state.ressources.find(c => c.id == id),
- },
+ state: () => ({}),
actions: {
async post(ressource: FormData): Promise<Node> {
const request = await makeRequest(`ressources`, 'POST', ressource);
@@ -59,9 +52,5 @@ export const useRessourcesStore = defineStore('ressources', {
});
return { deletedIds, failedIds };
},
- clear() {
- this.ressources = [];
- this.isFetching = false;
- },
},
});
diff --git a/frontend/app/stores/user.store.ts b/frontend/app/stores/user.store.ts
index dfa2eda6..cc2ec3cd 100644
--- a/frontend/app/stores/user.store.ts
+++ b/frontend/app/stores/user.store.ts
@@ -124,7 +124,6 @@ export const useUserStore = defineStore('user', {
async post_logout() {
this.user = undefined;
useNodesStore().clear();
- useRessourcesStore().clear();
useUserStore().clear();
if (import.meta.client) localStorage.removeItem('isLoggedIn');
},