mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
remove owned_by_current_user and refactor
This commit is contained in:
@@ -21,6 +21,5 @@ export type CollectionSchema = {
|
||||
url_cover: (string | null);
|
||||
user_id: number;
|
||||
owner_username: string;
|
||||
owned_by_current_user: boolean;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,5 @@ export type SmartCollectionSchema = {
|
||||
filter_summary: string;
|
||||
user_id: number;
|
||||
owner_username: string;
|
||||
owned_by_current_user: boolean;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ async function fetchRoms() {
|
||||
});
|
||||
|
||||
romsStore
|
||||
.fetchRoms({
|
||||
concat: false,
|
||||
})
|
||||
.fetchRoms(false)
|
||||
.then(() => {
|
||||
emitter?.emit("showLoadingDialog", {
|
||||
loading: false,
|
||||
|
||||
@@ -86,9 +86,7 @@ const emitter = inject<Emitter<Events>>("emitter");
|
||||
const onFilterChange = debounce(
|
||||
() => {
|
||||
romsStore.resetPagination();
|
||||
romsStore.fetchRoms({
|
||||
concat: false,
|
||||
});
|
||||
romsStore.fetchRoms(false);
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
// Update URL with filters
|
||||
|
||||
@@ -43,9 +43,7 @@ const onFilterChange = debounce(
|
||||
() => {
|
||||
romsStore.resetPagination();
|
||||
galleryFilterStore.setFilterMissing(true);
|
||||
romsStore.fetchRoms({
|
||||
concat: false,
|
||||
});
|
||||
romsStore.fetchRoms(false);
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
// Update URL with filters
|
||||
@@ -73,7 +71,7 @@ async function fetchRoms() {
|
||||
|
||||
galleryFilterStore.setFilterMissing(true);
|
||||
romsStore
|
||||
.fetchRoms({})
|
||||
.fetchRoms()
|
||||
.catch((error) => {
|
||||
console.error("Error fetching missing games:", error);
|
||||
emitter?.emit("snackbarShow", {
|
||||
@@ -93,7 +91,7 @@ function cleanupAll() {
|
||||
romsStore.setLimit(10000);
|
||||
galleryFilterStore.setFilterMissing(true);
|
||||
romsStore
|
||||
.fetchRoms({})
|
||||
.fetchRoms()
|
||||
.then(() => {
|
||||
emitter?.emit("showLoadingDialog", {
|
||||
loading: false,
|
||||
|
||||
@@ -136,7 +136,7 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) {
|
||||
romsStore.resetPagination();
|
||||
romsStore.setOrderBy(key);
|
||||
romsStore.setOrderDir(order);
|
||||
romsStore.fetchRoms({});
|
||||
romsStore.fetchRoms();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -318,9 +318,7 @@ async function fetchRoms() {
|
||||
romsStore.setOrderDir("asc");
|
||||
romsStore.resetPagination();
|
||||
|
||||
const fetchedRoms = await romsStore.fetchRoms({
|
||||
concat: false,
|
||||
});
|
||||
const fetchedRoms = await romsStore.fetchRoms(false);
|
||||
|
||||
if (selectedIndex.value >= fetchedRoms.length) selectedIndex.value = 0;
|
||||
await nextTick();
|
||||
|
||||
@@ -193,11 +193,7 @@ export default defineStore("roms", {
|
||||
galleryFilter.setFilterPlayerCounts(filter_values.player_counts);
|
||||
}
|
||||
},
|
||||
async fetchRoms({
|
||||
concat = true,
|
||||
}: {
|
||||
concat?: boolean;
|
||||
}): Promise<SimpleRom[]> {
|
||||
async fetchRoms(concat = true): Promise<SimpleRom[]> {
|
||||
if (this.fetchingRoms) return Promise.resolve([]);
|
||||
this.fetchingRoms = true;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ async function fetchRoms() {
|
||||
});
|
||||
|
||||
romsStore
|
||||
.fetchRoms({})
|
||||
.fetchRoms()
|
||||
.then(() => {
|
||||
emitter?.emit("showLoadingDialog", {
|
||||
loading: false,
|
||||
|
||||
@@ -48,7 +48,7 @@ async function fetchRoms() {
|
||||
});
|
||||
|
||||
romsStore
|
||||
.fetchRoms({})
|
||||
.fetchRoms()
|
||||
.then(() => {
|
||||
emitter?.emit("showLoadingDialog", {
|
||||
loading: false,
|
||||
|
||||
@@ -99,7 +99,7 @@ function onGameTouchEnd() {
|
||||
}
|
||||
|
||||
function fetchRoms() {
|
||||
romsStore.fetchRoms({}).catch((error) => {
|
||||
romsStore.fetchRoms().catch((error) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `Couldn't fetch roms: ${error}`,
|
||||
icon: "mdi-close-circle",
|
||||
|
||||
Reference in New Issue
Block a user