refactor: move from network strategies to generic interceptor service (#3242)

This commit is contained in:
Andrew Bastin
2023-08-21 07:50:35 +05:30
committed by GitHub
parent d4d1e27ba9
commit 10bb68a538
33 changed files with 1470 additions and 1314 deletions

View File

@@ -5,6 +5,9 @@ import { def as collectionsDef } from "./platform/collections/collections.platfo
import { def as settingsDef } from "./platform/settings/settings.platform"
import { def as historyDef } from "./platform/history/history.platform"
import { def as tabStateDef } from "./platform/tabState/tabState.platform"
import { browserInterceptor } from "@hoppscotch/common/platform/std/interceptors/browser"
import { proxyInterceptor } from "@hoppscotch/common/platform/std/interceptors/proxy"
import { ExtensionInterceptorService } from "@hoppscotch/common/platform/std/interceptors/extension"
createHoppApp("#app", {
auth: authDef,
@@ -15,6 +18,14 @@ createHoppApp("#app", {
history: historyDef,
tabState: tabStateDef,
},
interceptors: {
default: "browser",
interceptors: [
{ type: "standalone", interceptor: browserInterceptor },
{ type: "standalone", interceptor: proxyInterceptor },
{ type: "service", service: ExtensionInterceptorService },
],
},
platformFeatureFlags: {
exportAsGIST: false,
},

View File

@@ -10,7 +10,7 @@ import * as E from "fp-ts/Either"
import { runGQLSubscription } from "@hoppscotch/common/helpers/backend/GQLClient"
import {
bulkApplySettings,
defaultSettings,
getDefaultSettings,
} from "@hoppscotch/common/newstore/settings"
import { runDispatchWithOutSyncing } from "@lib/sync"
@@ -47,7 +47,7 @@ async function loadUserSettings() {
// create user settings if it doesn't exist
E.isLeft(res) &&
res.left.error == "user_settings/not_found" &&
(await createUserSettings(JSON.stringify(defaultSettings)))
(await createUserSettings(JSON.stringify(getDefaultSettings())))
if (E.isRight(res)) {
runDispatchWithOutSyncing(() => {