forked from extern/bruno
chore: refactor request type names
This commit is contained in:
parent
6b0ccac1bf
commit
097a6240ad
@ -112,7 +112,7 @@ const RequestTabPanel = () => {
|
|||||||
className="px-4"
|
className="px-4"
|
||||||
style={{width: `${leftPaneWidth}px`, height: 'calc(100% - 5px)'}}
|
style={{width: `${leftPaneWidth}px`, height: 'calc(100% - 5px)'}}
|
||||||
>
|
>
|
||||||
{item.type === 'graphql-request' ? (
|
{item.type === 'graphql' ? (
|
||||||
<GraphQLRequestPane
|
<GraphQLRequestPane
|
||||||
onRunQuery={runQuery}
|
onRunQuery={runQuery}
|
||||||
schema={schema}
|
schema={schema}
|
||||||
@ -122,7 +122,7 @@ const RequestTabPanel = () => {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{item.type === 'http-request' ? (
|
{item.type === 'http' ? (
|
||||||
<HttpRequestPane
|
<HttpRequestPane
|
||||||
item={item}
|
item={item}
|
||||||
collection={collection}
|
collection={collection}
|
||||||
|
@ -3,7 +3,7 @@ import classnames from 'classnames';
|
|||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const RequestMethod = ({item}) => {
|
const RequestMethod = ({item}) => {
|
||||||
if(!['http-request', 'graphql-request'].includes(item.type)) {
|
if(!['http', 'graphql'].includes(item.type)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
|
|||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
requestName: '',
|
requestName: '',
|
||||||
requestType: 'http-request',
|
requestType: 'http',
|
||||||
requestUrl: '',
|
requestUrl: '',
|
||||||
requestMethod: 'get'
|
requestMethod: 'get'
|
||||||
},
|
},
|
||||||
@ -84,27 +84,27 @@ const NewRequest = ({collection, item, isEphermal, onClose}) => {
|
|||||||
|
|
||||||
<div className="flex items-center mt-2">
|
<div className="flex items-center mt-2">
|
||||||
<input
|
<input
|
||||||
id="http-request"
|
id="http"
|
||||||
className="cursor-pointer"
|
className="cursor-pointer"
|
||||||
type="radio" name="requestType"
|
type="radio" name="requestType"
|
||||||
onChange={formik.handleChange}
|
onChange={formik.handleChange}
|
||||||
value="http-request"
|
value="http"
|
||||||
checked={formik.values.requestType === 'http-request'}
|
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
|
<input
|
||||||
id="graphql-request"
|
id="graphql"
|
||||||
className="ml-4 cursor-pointer"
|
className="ml-4 cursor-pointer"
|
||||||
type="radio" name="requestType"
|
type="radio" name="requestType"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
formik.setFieldValue('requestMethod', 'post')
|
formik.setFieldValue('requestMethod', 'post')
|
||||||
formik.handleChange(event);
|
formik.handleChange(event);
|
||||||
}}
|
}}
|
||||||
value="graphql-request"
|
value="graphql"
|
||||||
checked={formik.values.requestType === 'graphql-request'}
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ const useIdb = () => {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let dbName = `grafnode`;
|
let dbName = `bruno`;
|
||||||
let connection = openDB(dbName, 2, {
|
let connection = openDB(dbName, 2, {
|
||||||
upgrade(db, oldVersion, newVersion, transaction) {
|
upgrade(db, oldVersion, newVersion, transaction) {
|
||||||
switch(oldVersion) {
|
switch(oldVersion) {
|
||||||
|
@ -27,7 +27,7 @@ export const createCollection = (collectionName) => (dispatch, getState) => {
|
|||||||
|
|
||||||
const requestItem = {
|
const requestItem = {
|
||||||
uid: uuid(),
|
uid: uuid(),
|
||||||
type: 'http-request',
|
type: 'http',
|
||||||
name: 'Untitled',
|
name: 'Untitled',
|
||||||
request: {
|
request: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -39,7 +39,7 @@ const reducer = (state, action) => {
|
|||||||
draft.requestTabs.push({
|
draft.requestTabs.push({
|
||||||
uid: uid,
|
uid: uid,
|
||||||
name: 'New Tab',
|
name: 'New Tab',
|
||||||
type: 'graphql-request',
|
type: 'graphql',
|
||||||
request: {
|
request: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: 'https://api.spacex.land/graphql/',
|
url: 'https://api.spacex.land/graphql/',
|
||||||
|
@ -244,7 +244,7 @@ export const deleteItemInCollection = (itemUid, collection) => {
|
|||||||
|
|
||||||
export const isItemARequest = (item) => {
|
export const isItemARequest = (item) => {
|
||||||
return item.hasOwnProperty('request')
|
return item.hasOwnProperty('request')
|
||||||
&& ['http-request', 'graphql-request'].includes(item.type)
|
&& ['http', 'graphql'].includes(item.type)
|
||||||
&& !item.items;
|
&& !item.items;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import each from 'lodash/each';
|
import each from 'lodash/each';
|
||||||
import filter from 'lodash/filter';
|
import filter from 'lodash/filter';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
import { rawRequest, gql } from 'graphql-request';
|
import { rawRequest, gql } from 'graphql';
|
||||||
import { sendHttpRequestInBrowser } from './browser';
|
import { sendHttpRequestInBrowser } from './browser';
|
||||||
|
|
||||||
const sendNetworkRequest = async (item) => {
|
const sendNetworkRequest = async (item) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if(item.type === 'http-request') {
|
if(item.type === 'http') {
|
||||||
const timeStart = Date.now();
|
const timeStart = Date.now();
|
||||||
sendHttpRequest(item.draft ? item.draft.request : item.request)
|
sendHttpRequest(item.draft ? item.draft.request : item.request)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -86,7 +86,7 @@ const sendHttpRequest = async (request) => {
|
|||||||
.catch(reject);
|
.catch(reject);
|
||||||
|
|
||||||
// ipcRenderer
|
// ipcRenderer
|
||||||
// .invoke('send-http-request', options)
|
// .invoke('send-http', options)
|
||||||
// .then(resolve)
|
// .then(resolve)
|
||||||
// .catch(reject);
|
// .catch(reject);
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import find from 'lodash/find';
|
import find from 'lodash/find';
|
||||||
|
|
||||||
export const isItemARequest = (item) => {
|
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) => {
|
export const isItemAFolder = (item) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user