68 lines
1.9 KiB
JavaScript
68 lines
1.9 KiB
JavaScript
|
|
import {defineStore} from 'pinia';
|
||
|
|
import moment from 'moment-timezone';
|
||
|
|
import {ref, computed} from 'vue';
|
||
|
|
|
||
|
|
const apikey = import.meta.env.VITE_API_KEY;
|
||
|
|
const apiUrl = import.meta.env.PROD
|
||
|
|
? "https://api.digisnaxx.com"
|
||
|
|
: "http://localhost:8000";
|
||
|
|
|
||
|
|
export const useMenuStore = defineStore('MenuOptions', {
|
||
|
|
state: () => {
|
||
|
|
return {
|
||
|
|
headers: {
|
||
|
|
"content-type": "application/json",
|
||
|
|
"Authorization": `${apikey}`,
|
||
|
|
},
|
||
|
|
showMenu: false,
|
||
|
|
isHidden: true,
|
||
|
|
today: ref(""),
|
||
|
|
new_msg: "",
|
||
|
|
social_links: [],
|
||
|
|
social_images: [],
|
||
|
|
blog_posts: [],
|
||
|
|
snaxx: [],
|
||
|
|
};
|
||
|
|
},
|
||
|
|
|
||
|
|
actions: {
|
||
|
|
async get_today(){
|
||
|
|
this.today = moment().tz("America/Chicago");
|
||
|
|
},
|
||
|
|
|
||
|
|
close_menu(name){
|
||
|
|
this.showMenu = !this.showMenu;
|
||
|
|
this.get_today();
|
||
|
|
},
|
||
|
|
|
||
|
|
async fetchSocialLinkList() {
|
||
|
|
const results = await fetch(`${apiUrl}/socials/list-links`, {headers: this.headers});
|
||
|
|
const data = await results.json();
|
||
|
|
this.social_links = data;
|
||
|
|
},
|
||
|
|
|
||
|
|
async fetchSocialLinks() {
|
||
|
|
const results = await fetch(`${apiUrl}/socials/links`, {headers: this.headers});
|
||
|
|
const data = await results.json();
|
||
|
|
this.social_links = data;
|
||
|
|
},
|
||
|
|
|
||
|
|
async fetchSocialImages() {
|
||
|
|
const results = await fetch(`${apiUrl}/socials/images`, {headers: this.headers});
|
||
|
|
const data = await results.json();
|
||
|
|
this.social_images = data;
|
||
|
|
},
|
||
|
|
|
||
|
|
async fetchBlogPosts() {
|
||
|
|
const results = await fetch('https://canin.dreamfreely.org/ghost/api/content/posts/?key=ef0447585c290da508e6684916&filter=tag%3A-digisnaxx');
|
||
|
|
const data = await results.json();
|
||
|
|
this.blog_posts = data.posts;
|
||
|
|
},
|
||
|
|
|
||
|
|
async fetchDigiSnaxx() {
|
||
|
|
const results = await fetch('https://canin.dreamfreely.org/ghost/api/content/posts/?key=ef0447585c290da508e6684916&filter=tag%3Adigisnaxx');
|
||
|
|
const data = await results.json();
|
||
|
|
this.snaxx = data.posts;
|
||
|
|
},
|
||
|
|
}
|
||
|
|
});
|