build change
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { R as myAxios, a as useConfigStore, s as supabase } from './server.mjs';
|
||||
|
||||
const getStories = async (page = 1, limit = 100) => {
|
||||
return await myAxios.post("/media/story", { page, limit });
|
||||
};
|
||||
const getUserStories = async (userId, page = 1, limit = 100) => {
|
||||
return await myAxios.post(`/media/user-story/${userId}`, { page, limit });
|
||||
};
|
||||
const getUserPosts = async (userId, page = 1, limit = 15) => {
|
||||
return await myAxios.post(`/media/user-posts/${userId}`, { page, limit });
|
||||
};
|
||||
const getStoreSearchPosts = async (userId, data) => {
|
||||
const config = useConfigStore();
|
||||
if (config.APP_TYPE === "single")
|
||||
return await myAxios.post(`/media/store-posts/${userId}`, data);
|
||||
else
|
||||
return await myAxios.post(`/media/store-posts`, data);
|
||||
};
|
||||
const getHighlightsList = async (userId, data) => {
|
||||
return await myAxios.post(`/media/user-highlight/${userId}`, data);
|
||||
};
|
||||
async function userViewStory(user_id, media_id) {
|
||||
await supabase.from("storyviews").insert({
|
||||
user_id,
|
||||
media_id
|
||||
});
|
||||
}
|
||||
const storySeenKey = "story-seen";
|
||||
const setStorySeenLocal = (storyId) => {
|
||||
const seen = localStorage.getItem(storySeenKey);
|
||||
let seenArray = [];
|
||||
if (seen?.length)
|
||||
seenArray = JSON.parse(seen);
|
||||
seenArray.push(storyId);
|
||||
localStorage.setItem(storySeenKey, JSON.stringify(seenArray));
|
||||
};
|
||||
const getStorySeenLocal = () => {
|
||||
const seen = localStorage.getItem(storySeenKey);
|
||||
let seenArray = [];
|
||||
if (seen?.length)
|
||||
seenArray = JSON.parse(seen);
|
||||
return seenArray;
|
||||
};
|
||||
const isStoryInLocalSeen = (storyId) => {
|
||||
return getStorySeenLocal().indexOf(storyId) >= 0;
|
||||
};
|
||||
const clearStorySeen = () => localStorage.setItem(storySeenKey, JSON.stringify([]));
|
||||
|
||||
export { getUserPosts as a, getStories as b, clearStorySeen as c, getHighlightsList as d, getUserStories as e, getStoreSearchPosts as g, isStoryInLocalSeen as i, setStorySeenLocal as s, userViewStory as u };
|
||||
Reference in New Issue
Block a user