25 lines
568 B
TypeScript
25 lines
568 B
TypeScript
|
|
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(
|
||
|
|
`/sticker/${uuid}`,
|
||
|
|
);
|
||
|
|
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,
|
||
|
|
};
|
||
|
|
},
|
||
|
|
})
|