whois/stores/settings.ts
2024-03-25 06:55:06 +08:00

39 lines
943 B
TypeScript

import {defineStore} from 'pinia'
export const useSettingsStore = defineStore('settings', {
state: () => {
const {t} = useI18n()
return {
isHistory: true,
isBulletin: true,
isDomainList: true,
linkOpenType: 'currentWindow',
selectedOption: 'whois',
domainSearch: '',
}
},
actions: {
setHistory(value: boolean) {
this.isHistory = value
},
setLinkOpenType(value: string) {
this.linkOpenType = value
},
setSelectedOption(name: string) {
this.selectedOption = name;
}
},
getters: {
getHistory: (state: any) => state.isHistory,
getDomain(state: any) {
return state.domainSearch;
}
},
persist: {
storage: persistedState.cookiesWithOptions({
sameSite: 'strict',
}),
},
})