Add remote QB support

This commit is contained in:
CzBiX
2020-10-02 18:10:25 +08:00
parent e10fae3bf1
commit c5feb50585
11 changed files with 106 additions and 40 deletions

View File

@@ -5,7 +5,22 @@ import { ConfigState, ConfigPayload } from './types';
const configKey = 'qb-config';
export interface Config {
baseUrl: string | null;
updateInterval: number;
pageOptions: any;
filter: {
state: string | null;
category: string | null;
site: string | null;
query: string | null;
};
locale: string | null;
darkMode: string | null;
}
const defaultConfig = {
baseUrl: null,
updateInterval: 2000,
pageOptions: {
itemsPerPage: 50,
@@ -20,8 +35,6 @@ const defaultConfig = {
darkMode: null,
};
export type Config = typeof defaultConfig
function saveConfig(obj: any) {
localStorage.setItem(configKey, JSON.stringify(obj));
}

View File

@@ -27,6 +27,7 @@ const store = new Vuex.Store<RootState>({
mainData: undefined,
preferences: null,
pasteUrl: null,
needAuth: false,
},
mutations: {
/* eslint-disable no-param-reassign */
@@ -60,6 +61,9 @@ const store = new Vuex.Store<RootState>({
const { url } = payload;
state.pasteUrl = url;
},
updateNeedAuth(state, payload) {
state.needAuth = payload;
},
/* eslint-enable no-param-reassign */
},
getters: {

View File

@@ -6,6 +6,7 @@ export interface RootState {
mainData?: MainData;
preferences: any;
pasteUrl: string | null;
needAuth: boolean;
}
export interface SearchEnginePage {