feathers.ts 834 B

1234567891011121314151617181920212223242526272829303132
  1. import { createClient } from "musare-server"
  2. import socketio from "@feathersjs/socketio-client"
  3. import io from "socket.io-client"
  4. import { createPiniaClient } from "feathers-pinia"
  5. import { pinia } from "./pinia";
  6. const socket = io(`${document.location.protocol}//${document.location.host}`, {
  7. path: "/api/socket.io",
  8. transports: ["websocket"]
  9. })
  10. const feathersClient = createClient(socketio(socket), { storage: window.localStorage })
  11. export const api = createPiniaClient(feathersClient, {
  12. pinia,
  13. idField: 'id',
  14. // optional
  15. ssr: false,
  16. whitelist: [],
  17. paramsForServer: [],
  18. skipGetIfExists: true,
  19. customSiftOperators: {},
  20. setupInstance(data) {
  21. return data
  22. },
  23. customizeStore(defaultStore) {
  24. return {}
  25. },
  26. services: {},
  27. });
  28. console.log(111, feathersClient, api);