feat: request local persistence
This commit is contained in:
@@ -35,6 +35,8 @@ import {
|
|||||||
setGlobalEnvVariables,
|
setGlobalEnvVariables,
|
||||||
globalEnv$,
|
globalEnv$,
|
||||||
} from "./environments"
|
} from "./environments"
|
||||||
|
import { restRequest$, setRESTRequest } from "./RESTSession"
|
||||||
|
import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest"
|
||||||
|
|
||||||
function checkAndMigrateOldSettings() {
|
function checkAndMigrateOldSettings() {
|
||||||
const vuexData = JSON.parse(window.localStorage.getItem("vuex") || "{}")
|
const vuexData = JSON.parse(window.localStorage.getItem("vuex") || "{}")
|
||||||
@@ -195,10 +197,26 @@ function setupGlobalEnvsPersistence() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupRequestPersistence() {
|
||||||
|
const localRequest = JSON.parse(
|
||||||
|
window.localStorage.getItem("restRequest") || "null"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (localRequest) {
|
||||||
|
const parsedLocal = translateToNewRequest(localRequest)
|
||||||
|
setRESTRequest(parsedLocal)
|
||||||
|
}
|
||||||
|
|
||||||
|
restRequest$.subscribe((req) => {
|
||||||
|
window.localStorage.setItem("restRequest", JSON.stringify(req))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function setupLocalPersistence() {
|
export function setupLocalPersistence() {
|
||||||
checkAndMigrateOldSettings()
|
checkAndMigrateOldSettings()
|
||||||
|
|
||||||
setupSettingsPersistence()
|
setupSettingsPersistence()
|
||||||
|
setupRequestPersistence()
|
||||||
setupHistoryPersistence()
|
setupHistoryPersistence()
|
||||||
setupCollectionsPersistence()
|
setupCollectionsPersistence()
|
||||||
setupGlobalEnvsPersistence()
|
setupGlobalEnvsPersistence()
|
||||||
|
|||||||
Reference in New Issue
Block a user