import {defineStore} from 'pinia'
import activityApi from "app/src/api/activity/activity";
import {ref} from "vue";

export const useCurrentActivityStore =
  defineStore('currentActivity', () => {
      let currentActivity = ref()

      async function loadCurrentActivity() {
        if (currentActivity.value) {
          return currentActivity
        }

        currentActivity.value = await activityApi.getCurrent()
        return currentActivity
      }

      return {currentActivity, loadCurrentActivity}
    }
  )
