import { defineStore } from "pinia";
import axios from "axios";
import appService from "../../services/appService";
export const useFrontendBannerStore = defineStore("frontendBanner", {
    state: () => ({
        lists: [],
    }),
    actions: {
        fetchLists: function (payload) {
            return new Promise((resolve, reject) => {
                let url = "frontend/banner";
                if (payload) {
                    url = url + appService.requestHandler(payload);
                }
                axios.get(url).then((res) => {
                    this.lists = res.data.data;
                    resolve(res);
                }).catch((err) => {
                    reject(err);
                });
            });
        }
    },
});
