select Brand
This commit is contained in:
parent
b144d0cc19
commit
b00b70974d
22
src/seed.ts
22
src/seed.ts
|
@ -1,5 +1,27 @@
|
|||
export const SEED_VERSION = 1;
|
||||
|
||||
export const medias = [
|
||||
{schluessel: "kb", name: "Kleinbild", beschreibung: ''},
|
||||
{schluessel: "rf9x9", name: "Rollfilm 9x9", beschreibung: ''},
|
||||
{schluessel: "rf6x9", name: "Rollfilm 9x9", beschreibung: ''},
|
||||
{schluessel: "SD", name: "SD-Card", beschreibung: ''},
|
||||
{schluessel: "microSD", name: "microSD-Card", beschreibung: ''},
|
||||
{schluessel: "miniSD", name: "miniSD-Card", beschreibung: ''},
|
||||
];
|
||||
|
||||
export const batteries = [
|
||||
{schluessel: "aaa", name: "AAA", beschreibung: ''},
|
||||
{schluessel: "aa", name: "AA", beschreibung: ''},
|
||||
{schluessel: "spezial", name: "SpezialAkku", beschreibung: ''},
|
||||
];
|
||||
|
||||
export const lensconnector = [
|
||||
{schluessel: "a-mount", name: "A-Mount", beschreibung: ''},
|
||||
{schluessel: "e-mount", name: "E-Mount", beschreibung: ''},
|
||||
{schluessel: "ef-bajonett", name: "EF-Bajonett", beschreibung: ''},
|
||||
];
|
||||
|
||||
|
||||
|
||||
export const conditions = [
|
||||
{schluessel: "neu", name: "neu", beschreibung: ''},
|
||||
|
|
|
@ -13,6 +13,7 @@ const state = {
|
|||
cameras: [],
|
||||
brands: [],
|
||||
conditions: [],
|
||||
medias: [],
|
||||
buildtypes: []
|
||||
|
||||
};
|
||||
|
@ -30,6 +31,10 @@ const getters = {
|
|||
conditions: (state: any) => state.conditions,
|
||||
condition: (state: any) => (id: any) => state.conditions.find((condition: any) => condition.schluessel === id),
|
||||
|
||||
medias: (state: any) => state.medias,
|
||||
media: (state: any) => (id: any) => state.medias.find((condition: any) => media.schluessel === id),
|
||||
|
||||
|
||||
buildtypes: (state: any) => state.buildtypes,
|
||||
buildtype: (state: any) => (id: any) => state.buildtypes.find((buildtype: any) => buildtype.schluessel === id),
|
||||
|
||||
|
@ -77,19 +82,17 @@ const mutations = {
|
|||
objCamera.edit = payload.edit;
|
||||
},
|
||||
setBrands(state:any, payload:any) {
|
||||
// console.log("mutation.setBrands");
|
||||
state.brands = payload;
|
||||
// console.log("STORE", state.brands);
|
||||
},
|
||||
setMedias(state:any, payload:any) {
|
||||
state.medias = payload;
|
||||
},
|
||||
|
||||
setConditions(state:any, payload:any) {
|
||||
//console.log("mutation.setConditions");
|
||||
state.conditions = payload;
|
||||
//console.log("STORE", state.conditions);
|
||||
},
|
||||
setBuildtypes(state:any, payload:any) {
|
||||
//console.log("mutation.setBuildtypes");
|
||||
state.buildtypes = payload;
|
||||
//console.log("STORE", state.buildtypes);
|
||||
},
|
||||
setInitialized(state:any, payload:boolean) {
|
||||
state.isInitialized = payload;
|
||||
|
@ -97,21 +100,29 @@ const mutations = {
|
|||
};
|
||||
const actions = {
|
||||
fetchCameras(context:ActionContext<any, any>) {
|
||||
console.log("action.fetchCameras")
|
||||
db.getItems("cameras").then((cameras) => {
|
||||
console.log("From DB", cameras);
|
||||
context.commit("setCameras", cameras);
|
||||
|
||||
})
|
||||
},
|
||||
fetchMedias(context:ActionContext<any, any>) {
|
||||
db.getItems("medias").then((rs) => {
|
||||
context.commit("setMedias", rs);
|
||||
})
|
||||
},
|
||||
fetchBrands(context:ActionContext<any, any>) {
|
||||
context.commit("setBrands", seed.brands);
|
||||
db.getItems("brands").then((rs) => {
|
||||
context.commit("setBrands", rs);
|
||||
})
|
||||
},
|
||||
fetchBuildTypes(context:ActionContext<any, any>) {
|
||||
context.commit("setBuildtypes", seed.buildtype);
|
||||
db.getItems("buildtype").then((rs) => {
|
||||
context.commit("setBuildtypes", rs);
|
||||
})
|
||||
},
|
||||
fetchCondition(context:ActionContext<any, any>) {
|
||||
context.commit("setConditions", seed.conditions);
|
||||
db.getItems("conditions").then((rs) => {
|
||||
context.commit("setConditions", rs);
|
||||
})
|
||||
},
|
||||
setCameraActiveState(context:ActionContext<any, any>, payload:any) {
|
||||
console.log("action.setCameraActiveState", payload)
|
||||
|
@ -156,6 +167,8 @@ const actions = {
|
|||
promises.push(db.saveItems(seed.conditions, "conditions"));
|
||||
promises.push(db.saveItems(seed.buildtype, "buildtypes"));
|
||||
promises.push(db.saveItems(seed.cameras, "cameras"));
|
||||
promises.push(db.saveItems(seed.medias, "medias"));
|
||||
|
||||
|
||||
localStorage.setItem("SEED_VERSION", seed.SEED_VERSION.toString())
|
||||
} else {
|
||||
|
@ -170,6 +183,7 @@ const actions = {
|
|||
context.dispatch("fetchBrands");
|
||||
context.dispatch("fetchBuildTypes");
|
||||
context.dispatch("fetchCondition");
|
||||
context.dispatch("fetchMedias");
|
||||
context.commit("setInitialized", true);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue