chore: refactor request type names

This commit is contained in:
Anoop M D 2022-10-14 00:43:03 +05:30
parent 6b0ccac1bf
commit 097a6240ad
9 changed files with 20 additions and 20 deletions

View File

@ -112,7 +112,7 @@ const RequestTabPanel = () => {
className="px-4"
style={{width: `${leftPaneWidth}px`, height: 'calc(100% - 5px)'}}
>
{item.type === 'graphql-request' ? (
{item.type === 'graphql' ? (
<GraphQLRequestPane
onRunQuery={runQuery}
schema={schema}
@ -122,7 +122,7 @@ const RequestTabPanel = () => {
/>
) : null}
{item.type === 'http-request' ? (
{item.type === 'http' ? (
<HttpRequestPane
item={item}
collection={collection}

View File

@ -3,7 +3,7 @@ import classnames from 'classnames';
import StyledWrapper from './StyledWrapper';
const RequestMethod = ({item}) => {
if(!['http-request', 'graphql-request'].includes(item.type)) {
if(!['http', 'graphql'].includes(item.type)) {
return null;
}

View File

@ -16,7 +16,7 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
enableReinitialize: true,
initialValues: {
requestName: '',
requestType: 'http-request',
requestType: 'http',
requestUrl: '',
requestMethod: 'get'
},
@ -84,27 +84,27 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
<div className="flex items-center mt-2">
<input
id="http-request"
id="http"
className="cursor-pointer"
type="radio" name="requestType"
onChange={formik.handleChange}
value="http-request"
checked={formik.values.requestType === 'http-request'}
value="http"
checked={formik.values.requestType === 'http'}
/>
<label htmlFor="http-request" className="ml-1 cursor-pointer select-none">Http</label>
<label htmlFor="http" className="ml-1 cursor-pointer select-none">Http</label>
<input
id="graphql-request"
id="graphql"
className="ml-4 cursor-pointer"
type="radio" name="requestType"
onChange={(event) => {
formik.setFieldValue('requestMethod', 'post')
formik.handleChange(event);
}}
value="graphql-request"
checked={formik.values.requestType === 'graphql-request'}
value="graphql"
checked={formik.values.requestType === 'graphql'}
/>
<label htmlFor="graphql-request" className="ml-1 cursor-pointer select-none">Graphql</label>
<label htmlFor="graphql" className="ml-1 cursor-pointer select-none">Graphql</label>
</div>
</div>

View File

@ -9,7 +9,7 @@ const useIdb = () => {
const dispatch = useDispatch();
useEffect(() => {
let dbName = `grafnode`;
let dbName = `bruno`;
let connection = openDB(dbName, 2, {
upgrade(db, oldVersion, newVersion, transaction) {
switch(oldVersion) {

View File

@ -27,7 +27,7 @@ export const createCollection = (collectionName) => (dispatch, getState) => {
const requestItem = {
uid: uuid(),
type: 'http-request',
type: 'http',
name: 'Untitled',
request: {
method: 'GET',

View File

@ -39,7 +39,7 @@ const reducer = (state, action) => {
draft.requestTabs.push({
uid: uid,
name: 'New Tab',
type: 'graphql-request',
type: 'graphql',
request: {
method: 'GET',
url: 'https://api.spacex.land/graphql/',

View File

@ -244,7 +244,7 @@ export const deleteItemInCollection = (itemUid, collection) => {
export const isItemARequest = (item) => {
return item.hasOwnProperty('request')
&& ['http-request', 'graphql-request'].includes(item.type)
&& ['http', 'graphql'].includes(item.type)
&& !item.items;
};

View File

@ -1,12 +1,12 @@
import each from 'lodash/each';
import filter from 'lodash/filter';
import qs from 'qs';
import { rawRequest, gql } from 'graphql-request';
import { rawRequest, gql } from 'graphql';
import { sendHttpRequestInBrowser } from './browser';
const sendNetworkRequest = async (item) => {
return new Promise((resolve, reject) => {
if(item.type === 'http-request') {
if(item.type === 'http') {
const timeStart = Date.now();
sendHttpRequest(item.draft ? item.draft.request : item.request)
.then((response) => {
@ -86,7 +86,7 @@ const sendHttpRequest = async (request) => {
.catch(reject);
// ipcRenderer
// .invoke('send-http-request', options)
// .invoke('send-http', options)
// .then(resolve)
// .catch(reject);
});

View File

@ -1,7 +1,7 @@
import find from 'lodash/find';
export const isItemARequest = (item) => {
return item.hasOwnProperty('request') && ['http-request', 'graphql-request'].includes(item.type);
return item.hasOwnProperty('request') && ['http', 'graphql'].includes(item.type);
};
export const isItemAFolder = (item) => {