Data & store

The module calls its own backend through the SDK's api client: /api/v1 prefix, cookies included. The host handles authentication — no token code on the module side.

API calls #

// frontend/src/api.ts — le client est fourni par le SDK (baseURL = /api/v1)
import { api } from '@kubuno/sdk'

export const listNotes  = () => api.get('/memo/notes').then(r => r.data.notes)
export const createNote = (dto: { title: string; body: string }) =>
  api.post('/memo/notes', dto).then(r => r.data.note)
export const deleteNote = (id: string) => api.delete(`/memo/notes/${id}`)
Note

All these requests go through the core, which authenticates them then proxies them to http://127.0.0.1:3190/notes…, injecting the identity.

The store (Zustand) #

// frontend/src/store.ts
import { create } from 'zustand'

interface MemoState {
  query: string
  selectedId: string | null
  setQuery: (q: string) => void
  select: (id: string | null) => void
}

export const useMemoStore = create<MemoState>((set) => ({
  query: '',
  selectedId: null,
  setQuery: (query) => set({ query }),
  select:   (selectedId) => set({ selectedId }),
}))

Module stores are local instances; only the SDK stores (auth, modules, notifications…) are shared singletons.