Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77452962
asset.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Aug 14, 14:16
Size
1 KB
Mime Type
text/x-java
Expires
Fri, Aug 16, 14:16 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
19871060
Attached To
R12546 Sesame - Configurator
asset.js
View Options
import { defineStore } from 'pinia';
import { ref } from 'vue';
import { upload, genericFetch, genericAdd, genericUpdate, genericRemove } from './utils';
// not process.env because we use VITE and not vue cli
const assetURL = import.meta.env.VITE_API_URL + '/assets';
const uploadThumbnail = async ({ thumbnail, ...rest }) => {
if (thumbnail)
thumbnail = await upload('assetThumbnail', 'thumbnail', thumbnail);
else thumbnail = null;
return { ...rest, thumbnail };
};
export const useSoundAssetStore = defineStore('SoundAsset', () => {
const state = ref([]);
const endpointURL = assetURL + '/sound';
const fetch = genericFetch(endpointURL, state);
return {
state, fetch,
add: genericAdd(endpointURL, fetch),
update: genericUpdate(endpointURL, fetch),
remove: genericRemove(endpointURL, fetch)
};
});
export const use2DAssetStore = defineStore('2DAsset', () => {
const state = ref({});
const endpointURL = assetURL + '/2d';
const fetch = genericFetch(endpointURL, state);
return {
state, fetch,
add: genericAdd(endpointURL, fetch, uploadThumbnail),
update: genericUpdate(endpointURL, fetch, uploadThumbnail),
remove: genericRemove(endpointURL, fetch)
};
});
export const use3DAssetStore = defineStore('3DAsset', () => {
const state = ref({});
const endpointURL = assetURL + '/3d';
const fetch = genericFetch(endpointURL, state);
return {
state, fetch,
add: genericAdd(endpointURL, fetch, uploadThumbnail),
update: genericUpdate(endpointURL, fetch, uploadThumbnail),
remove: genericRemove(endpointURL, fetch)
};
});
Event Timeline
Log In to Comment