2024-11-25 20:06:22 -05:00
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
|
|
|
|
|
export const useStickerStore = defineStore('sticker', {
|
|
|
|
|
actions: {
|
|
|
|
|
async fetch(uuid: string) {
|
|
|
|
|
console.log('fetch');
|
|
|
|
|
// TODO: Check if we have it already and if it's stale.
|
|
|
|
|
const response = await fetch(
|
2024-11-26 11:30:20 -05:00
|
|
|
`/api/sticker/${uuid}`,
|
2024-11-25 20:06:22 -05:00
|
|
|
);
|
|
|
|
|
const json = await response.json();
|
|
|
|
|
console.log(json);
|
|
|
|
|
// this.stickers.push(json);
|
|
|
|
|
this.sticker = json;
|
|
|
|
|
console.log('done in fetch');
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
state: () => {
|
|
|
|
|
return {
|
|
|
|
|
// stickers: [],
|
|
|
|
|
sticker: null,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
})
|