mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
chore: refactor request type names
This commit is contained in:
parent
6b0ccac1bf
commit
097a6240ad
@ -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}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -27,7 +27,7 @@ export const createCollection = (collectionName) => (dispatch, getState) => {
|
||||
|
||||
const requestItem = {
|
||||
uid: uuid(),
|
||||
type: 'http-request',
|
||||
type: 'http',
|
||||
name: 'Untitled',
|
||||
request: {
|
||||
method: 'GET',
|
||||
|
@ -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/',
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user