diff --git a/layouts/error.vue b/layouts/error.vue index b86de742d..1e1842130 100644 --- a/layouts/error.vue +++ b/layouts/error.vue @@ -1,19 +1,60 @@ - - {{ error.statusCode }} - {{ error.message }} - + {{ statusCode }} + {{ message }} + - {{ $t("go_home") }} + + home + + {{ $t("go_home") }} + + - - - {{ $t("reload") }} + + refresh + + {{ $t("reload") }} + + + + - - diff --git a/newstore/localpersistence.ts b/newstore/localpersistence.ts index 919050cf0..f985b727a 100644 --- a/newstore/localpersistence.ts +++ b/newstore/localpersistence.ts @@ -1,7 +1,7 @@ -import { settingsStore, bulkApplySettings, defaultSettings } from "./settings" import clone from "lodash/clone" import assign from "lodash/assign" import eq from "lodash/eq" +import { settingsStore, bulkApplySettings, defaultSettings } from "./settings" function checkAndMigrateOldSettings() { const vuexData = JSON.parse(window.localStorage.getItem("vuex") || "{}") @@ -19,7 +19,9 @@ function checkAndMigrateOldSettings() { } function setupSettingsPersistence() { - const settingsData = JSON.parse(window.localStorage.getItem("settings") || "{}") + const settingsData = JSON.parse( + window.localStorage.getItem("settings") || "{}" + ) if (settingsData) { bulkApplySettings(settingsData) diff --git a/newstore/settings.ts b/newstore/settings.ts index ce2f9d174..4c7d87205 100644 --- a/newstore/settings.ts +++ b/newstore/settings.ts @@ -1,8 +1,8 @@ import { pluck, distinctUntilChanged } from "rxjs/operators" import has from "lodash/has" +import { Observable } from "rxjs" import DispatchingStore from "./DispatchingStore" import type { Dispatchers } from "./DispatchingStore" -import { Observable } from "rxjs" import type { KeysMatching } from "~/types/ts-utils" export const defaultSettings = { @@ -32,9 +32,14 @@ const dispatchers: Dispatchers = { bulkApplySettings(_currentState, payload: Partial) { return payload }, - toggleSetting(currentState, { settingKey }: { settingKey: KeysMatching }) { + toggleSetting( + currentState, + { settingKey }: { settingKey: KeysMatching } + ) { if (!has(currentState, settingKey)) { - console.log(`Toggling of a non-existent setting key '${settingKey}' ignored.`) + console.log( + `Toggling of a non-existent setting key '${settingKey}' ignored.` + ) return {} } @@ -48,7 +53,9 @@ const dispatchers: Dispatchers = { { settingKey, value }: { settingKey: K; value: SettingsType[K] } ) { if (!validKeys.includes(settingKey)) { - console.log(`Ignoring non-existent setting key '${settingKey}' assignment`) + console.log( + `Ignoring non-existent setting key '${settingKey}' assignment` + ) return {} } @@ -83,7 +90,10 @@ export function toggleSetting(settingKey: KeysMatching) { }) } -export function applySetting(settingKey: K, value: SettingsType[K]) { +export function applySetting( + settingKey: K, + value: SettingsType[K] +) { settingsStore.dispatch({ dispatcher: "applySetting", payload: { diff --git a/nuxt.config.js b/nuxt.config.js index 9129975a7..547d6a9a1 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -165,8 +165,8 @@ export default { // ESLint module configuration (https://github.com/nuxt-community/eslint-module) eslint: { // fix: true, - // emitWarning: true, - // quiet: true, + emitWarning: true, + quiet: true, }, // Toast module configuration (https://github.com/nuxt-community/modules/tree/master/packages/toast) diff --git a/static/icons/error.svg b/static/icons/error.svg deleted file mode 100644 index c9d02dd3b..000000000 --- a/static/icons/error.svg +++ /dev/null @@ -1,154 +0,0 @@ - - - - -Taken - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/store/postwoman.js b/store/postwoman.js index 9249f3af2..9f1f882f2 100644 --- a/store/postwoman.js +++ b/store/postwoman.js @@ -70,8 +70,14 @@ export const state = () => ({ export const mutations = { applySetting({ settings }, setting) { - if (setting === null || !(setting instanceof Array) || setting.length !== 2) { - throw new Error("You must provide a setting (array in the form [key, value])") + if ( + setting === null || + !(setting instanceof Array) || + setting.length !== 2 + ) { + throw new Error( + "You must provide a setting (array in the form [key, value])" + ) } const [key, value] = setting @@ -127,7 +133,7 @@ export const mutations = { state.environments = [...state.environments, ...environments] let index = 0 - for (let environment of state.environments) { + for (const environment of state.environments) { environment.environmentIndex = index index += 1 } @@ -159,20 +165,22 @@ export const mutations = { }, replaceCollections(state, item) { - let collections = item.data + const collections = item.data const flag = item.flag - if (flag == "rest") state.collections = collections + if (flag === "rest") state.collections = collections else state.collectionsGraphql = collections }, importCollections(state, item) { - let collections = item.data + const collections = item.data const flag = item.flag - if (flag == "rest") state.collections = [...state.collections, ...collections] - else state.collectionsGraphql = [...state.collectionsGraphql, ...collections] + if (flag === "rest") + state.collections = [...state.collections, ...collections] + else + state.collectionsGraphql = [...state.collectionsGraphql, ...collections] let index = 0 - for (let collection of collections) { + for (const collection of collections) { collection.collectionIndex = index index += 1 } @@ -182,7 +190,7 @@ export const mutations = { const name = collection.name const flag = collection.flag let duplicateCollection = null - if (flag == "rest") { + if (flag === "rest") { duplicateCollection = collections.some( (item) => item.name.toLowerCase() === name.toLowerCase() ) @@ -195,7 +203,7 @@ export const mutations = { this.$toast.info("Duplicate collection") return } - if (flag == "rest") { + if (flag === "rest") { collections.push({ name: "", folders: [], @@ -214,7 +222,7 @@ export const mutations = { removeCollection({ collections, collectionsGraphql }, payload) { const { collectionIndex, flag } = payload - if (flag == "rest") collections.splice(collectionIndex, 1) + if (flag === "rest") collections.splice(collectionIndex, 1) else collectionsGraphql.splice(collectionIndex, 1) }, @@ -222,7 +230,7 @@ export const mutations = { const { collection, collectionIndex, flag } = payload const { name } = collection let duplicateCollection = null - if (flag == "rest") { + if (flag === "rest") { duplicateCollection = collections.some( (item) => item.name.toLowerCase() === name.toLowerCase() ) @@ -235,14 +243,14 @@ export const mutations = { this.$toast.info("Duplicate collection") return } - if (flag == "rest") collections[collectionIndex] = collection + if (flag === "rest") collections[collectionIndex] = collection else collectionsGraphql[collectionIndex] = collection }, addFolder({ collections, collectionsGraphql }, payload) { const { name, path, flag } = payload const newFolder = { - name: name, + name, requests: [], folders: [], } @@ -251,7 +259,7 @@ export const mutations = { const indexPaths = path.split("/").map((x) => parseInt(x)) let target = null - if (flag == "rest") target = collections[indexPaths.shift()] + if (flag === "rest") target = collections[indexPaths.shift()] else target = collectionsGraphql[indexPaths.shift()] while (indexPaths.length > 0) target = target.folders[indexPaths.shift()] @@ -262,10 +270,10 @@ export const mutations = { editFolder({ collections, collectionsGraphql }, payload) { const { collectionIndex, folder, folderIndex, folderName, flag } = payload let collection = null - if (flag == "rest") collection = collections[collectionIndex] + if (flag === "rest") collection = collections[collectionIndex] else collection = collectionsGraphql[collectionIndex] - let parentFolder = findFolder(folderName, collection, true) + const parentFolder = findFolder(folderName, collection, true) if (parentFolder && parentFolder.folders) { Vue.set(parentFolder.folders, folderIndex, folder) } @@ -274,10 +282,10 @@ export const mutations = { removeFolder({ collections, collectionsGraphql }, payload) { const { collectionIndex, folderIndex, folderName, flag } = payload let collection = null - if (flag == "rest") collection = collections[collectionIndex] + if (flag === "rest") collection = collections[collectionIndex] else collection = collectionsGraphql[collectionIndex] - let parentFolder = findFolder(folderName, collection, true) + const parentFolder = findFolder(folderName, collection, true) if (parentFolder && parentFolder.folders) { parentFolder.folders.splice(folderIndex, 1) } @@ -293,7 +301,7 @@ export const mutations = { flag, } = payload let collection = null - if (flag == "rest") collection = collections[requestCollectionIndex] + if (flag === "rest") collection = collections[requestCollectionIndex] else collection = collectionsGraphql[requestCollectionIndex] if (requestFolderIndex === -1) { @@ -301,14 +309,15 @@ export const mutations = { return } - let folder = findFolder(requestFolderName, collection, false) + const folder = findFolder(requestFolderName, collection, false) Vue.set(folder.requests, requestIndex, requestNew) }, saveRequestAs({ collections, collectionsGraphql }, payload) { - let { request, collectionIndex, folderName, requestIndex, flag } = payload + let { request } = payload + const { collectionIndex, folderName, requestIndex, flag } = payload - if (flag == "rest") { + if (flag === "rest") { // Filter out all file inputs request = { ...request, @@ -325,26 +334,30 @@ export const mutations = { if (specifiedCollection && specifiedFolder && specifiedRequest) { const folder = findFolder( folderName, - flag == "rest" ? collections[collectionIndex] : collectionsGraphql[collectionIndex] + flag === "rest" + ? collections[collectionIndex] + : collectionsGraphql[collectionIndex] ) Vue.set(folder.requests, requestIndex, request) } else if (specifiedCollection && specifiedFolder && !specifiedRequest) { const folder = findFolder( folderName, - flag == "rest" ? collections[collectionIndex] : collectionsGraphql[collectionIndex] + flag === "rest" + ? collections[collectionIndex] + : collectionsGraphql[collectionIndex] ) const requests = folder.requests const lastRequestIndex = requests.length - 1 Vue.set(requests, lastRequestIndex + 1, request) } else if (specifiedCollection && !specifiedFolder && specifiedRequest) { const requests = - flag == "rest" + flag === "rest" ? collections[collectionIndex].requests : collectionsGraphql[collectionIndex].requests Vue.set(requests, requestIndex, request) } else if (specifiedCollection && !specifiedFolder && !specifiedRequest) { const requests = - flag == "rest" + flag === "rest" ? collections[collectionIndex].requests : collectionsGraphql[collectionIndex].requests const lastRequestIndex = requests.length - 1 @@ -355,14 +368,14 @@ export const mutations = { removeRequest({ collections, collectionsGraphql }, payload) { const { collectionIndex, folderName, requestIndex, flag } = payload let collection = null - if (flag == "rest") collection = collections[collectionIndex] + if (flag === "rest") collection = collections[collectionIndex] else collection = collectionsGraphql[collectionIndex] if (collection.name === folderName) { collection.requests.splice(requestIndex, 1) return } - let folder = findFolder(folderName, collection, false) + const folder = findFolder(folderName, collection, false) if (folder) { folder.requests.splice(requestIndex, 1) @@ -389,10 +402,10 @@ export const mutations = { } = payload const isCollection = newFolderIndex === -1 let oldCollection = null - if (flag == "rest") oldCollection = collections[oldCollectionIndex] + if (flag === "rest") oldCollection = collections[oldCollectionIndex] else oldCollection = collectionsGraphql[oldCollectionIndex] let newCollection = null - if (flag == "rest") newCollection = collections[newCollectionIndex] + if (flag === "rest") newCollection = collections[newCollectionIndex] else newCollection = collectionsGraphql[newCollectionIndex] const request = findRequest(oldFolderName, oldCollection, requestIndex) @@ -405,7 +418,6 @@ export const mutations = { const folder = findFolder(newFolderName, newCollection, false) if (folder) { folder.requests.push(request) - return } } }, @@ -424,7 +436,7 @@ function findRequest(folderName, currentFolder, requestIndex) { let selectedFolder, result if (folderName === currentFolder.name) { - let request = currentFolder.requests[requestIndex] + const request = currentFolder.requests[requestIndex] currentFolder.requests.splice(requestIndex, 1) return request } else { @@ -452,7 +464,12 @@ function findFolder(folderName, currentFolder, returnParent, parentFolder) { for (let i = 0; i < currentFolder.folders.length; i++) { selectedFolder = currentFolder.folders[i] - result = findFolder(folderName, selectedFolder, returnParent, currentFolder) + result = findFolder( + folderName, + selectedFolder, + returnParent, + currentFolder + ) if (result !== false) { return result diff --git a/types/ts-utils.d.ts b/types/ts-utils.d.ts index 3589bd1bf..d19b2d97c 100644 --- a/types/ts-utils.d.ts +++ b/types/ts-utils.d.ts @@ -1 +1,3 @@ -export type KeysMatching = { [K in keyof T]-?: T[K] extends V ? K : never }[keyof T] +export type KeysMatching = { + [K in keyof T]-?: T[K] extends V ? K : never +}[keyof T]
+
- {{ $t("go_home") }} + + home + + {{ $t("go_home") }} + + -
- {{ $t("reload") }} + + refresh + + {{ $t("reload") }} + +