rework login to wor with authentik
rework env handling a runtime remove oketbase
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { MarketOrderHistory, MarketType, MarketTypePrice, getHistory, jitaId } from "@/market";
|
||||
import { usePocketBase, watchCollection } from "@/pocketbase";
|
||||
import { defineStore } from "pinia";
|
||||
import { RecordModel } from "pocketbase";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
|
||||
export type ScanResult = {
|
||||
type: MarketType;
|
||||
@@ -12,7 +10,7 @@ export type ScanResult = {
|
||||
orderCount: number,
|
||||
}
|
||||
|
||||
interface MarketScan extends RecordModel {
|
||||
interface MarketScan {
|
||||
owner: string;
|
||||
types: number[];
|
||||
};
|
||||
@@ -20,16 +18,11 @@ interface MarketScan extends RecordModel {
|
||||
const marketScans = 'marketScans';
|
||||
|
||||
export const useMarketScanStore = defineStore(marketScans, () => {
|
||||
const pb = usePocketBase();
|
||||
const marketScan = ref<MarketScan>();
|
||||
|
||||
const types = computed(() => marketScan.value?.types ?? []);
|
||||
const setTypes = async (types: number[]) => {
|
||||
if (marketScan.value?.id) {
|
||||
marketScan.value = await pb.collection(marketScans).update(marketScan.value.id, { owner: pb.authStore.model!.id, types });
|
||||
} else {
|
||||
marketScan.value = await pb.collection(marketScans).create({ owner: pb.authStore.model!.id, types });
|
||||
}
|
||||
const setTypes = async (_types: number[]) => {
|
||||
|
||||
}
|
||||
const addType = async (type: number) => {
|
||||
if (!types.value.includes(type)) {
|
||||
@@ -41,15 +34,6 @@ export const useMarketScanStore = defineStore(marketScans, () => {
|
||||
await setTypes(types.value.filter(t => t !== type));
|
||||
}
|
||||
}
|
||||
|
||||
watchCollection<MarketScan>(marketScans, '*', data => {
|
||||
if (data.action === 'delete') {
|
||||
marketScan.value = undefined;
|
||||
} else if (!marketScan.value || data.record.id === marketScan.value.id) {
|
||||
marketScan.value = data.record;
|
||||
}
|
||||
});
|
||||
onMounted(async () => marketScan.value = await pb.collection(marketScans).getFirstListItem<MarketScan>('').catch(() => undefined));
|
||||
return { types, setTypes, addType, removeType };
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user