feat: remove save the last query to local storage (#1853)

This commit is contained in:
Yury Molodov 2021-11-30 01:58:27 +03:00 committed by Aliaksandr Valialkin
parent 500945499f
commit d0313b9401
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1
3 changed files with 2 additions and 5 deletions

View File

@ -2,7 +2,6 @@ import {useEffect, useMemo, useState} from "react";
import {getQueryRangeUrl, getQueryUrl} from "../../../api/query-range";
import {useAppState} from "../../../state/common/StateContext";
import {InstantMetricResult, MetricResult} from "../../../api/types";
import {saveToStorage} from "../../../utils/storage";
import {isValidHttpUrl} from "../../../utils/url";
import {useAuthState} from "../../../state/auth/AuthStateContext";
import {TimeParams} from "../../../types";
@ -56,7 +55,6 @@ export const useFetchQuery = (): {
try {
const response = await fetch(fetchUrl, { headers });
if (response.ok) {
saveToStorage("LAST_QUERY", query);
const resp = await response.json();
setError(undefined);
displayType === "chart" ? setGraphData(resp.data.result) : setLiveData(resp.data.result);

View File

@ -46,7 +46,7 @@ export type Action =
const duration = getQueryStringValue("g0.range_input", "1h") as string;
const endInput = formatDateToLocal(getQueryStringValue("g0.end_input", getDateNowUTC()) as Date);
const query = getQueryStringValue("g0.expr", getFromStorage("LAST_QUERY") as string || "\n") as string;
const query = getQueryStringValue("g0.expr", "") as string;
export const initialState: AppState = {
serverUrl: getDefaultServer(),

View File

@ -1,5 +1,4 @@
export type StorageKeys = "LAST_QUERY"
| "BASIC_AUTH_DATA"
export type StorageKeys = "BASIC_AUTH_DATA"
| "BEARER_AUTH_DATA"
| "AUTH_TYPE"
| "AUTOCOMPLETE"