import { ref } from 'vue';
import createStore from '@zjxpcyc/vue-tiny-store';

const useUser = () => {
  const user = ref();
  const setUser = u => user.value = u;

  return [
    user,
    setUser,
  ]
}

const usePoem = () => {
  const name = ref();
  const content = ref();

  return [
    name,
    content,
  ]
};

const useQRCode = () => {
  const content = ref()

  const update = (val) => {
    content.value = val;
  }

  return [
    content,
    update,
  ]
};

const store = createStore({ user: useUser, poem: usePoem, qrcode: useQRCode });

export default store;
