big update
This commit is contained in:
parent
d53ebf9ecd
commit
5c7e93fcc7
26 changed files with 1890 additions and 423 deletions
|
|
@ -1,9 +1,11 @@
|
|||
import { defineStore } from "pinia";
|
||||
|
||||
const STORAGE_KEY = "selectedCompany";
|
||||
|
||||
export const useCompanyStore = defineStore("company", {
|
||||
state: () => ({
|
||||
companies: ["Sprinklers Northwest", "Nuco Yard Care", "Lowe Fencing", "Veritas Stone", "Daniels Landscape Supplies"],
|
||||
selectedCompany: "Sprinklers Northwest",
|
||||
selectedCompany: localStorage.getItem(STORAGE_KEY) || "Sprinklers Northwest",
|
||||
}),
|
||||
|
||||
getters: {
|
||||
|
|
@ -14,6 +16,7 @@ export const useCompanyStore = defineStore("company", {
|
|||
setSelectedCompany(companyName) {
|
||||
if (this.companies.includes(companyName)) {
|
||||
this.selectedCompany = companyName;
|
||||
localStorage.setItem(STORAGE_KEY, companyName);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -21,6 +24,9 @@ export const useCompanyStore = defineStore("company", {
|
|||
this.companies = [...companies];
|
||||
if (!this.companies.includes(this.selectedCompany)) {
|
||||
this.selectedCompany = this.companies[0] || null;
|
||||
if (this.selectedCompany) {
|
||||
localStorage.setItem(STORAGE_KEY, this.selectedCompany);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue