mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-24 05:51:22 +02:00
refactor: Simplify logic around get method color (#2856)
* feat: Use theme provider to get method color * fix: Use storeTheme instead of theme
This commit is contained in:
parent
77750ecc0b
commit
d3e57d0ea6
@ -62,43 +62,9 @@ const RequestTab = ({ tab, collection, tabIndex, collectionRequestTabs, folderUi
|
|||||||
|
|
||||||
const getMethodColor = (method = '') => {
|
const getMethodColor = (method = '') => {
|
||||||
const theme = storedTheme === 'dark' ? darkTheme : lightTheme;
|
const theme = storedTheme === 'dark' ? darkTheme : lightTheme;
|
||||||
|
return theme.request.methods[method.toLocaleLowerCase()];
|
||||||
let color = '';
|
|
||||||
method = method.toLocaleLowerCase();
|
|
||||||
|
|
||||||
switch (method) {
|
|
||||||
case 'get': {
|
|
||||||
color = theme.request.methods.get;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'post': {
|
|
||||||
color = theme.request.methods.post;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'put': {
|
|
||||||
color = theme.request.methods.put;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'delete': {
|
|
||||||
color = theme.request.methods.delete;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'patch': {
|
|
||||||
color = theme.request.methods.patch;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'options': {
|
|
||||||
color = theme.request.methods.options;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'head': {
|
|
||||||
color = theme.request.methods.head;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return color;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const folder = folderUid ? findItemInCollection(collection, folderUid) : null;
|
const folder = folderUid ? findItemInCollection(collection, folderUid) : null;
|
||||||
if (['collection-settings', 'folder-settings', 'variables', 'collection-runner'].includes(tab.type)) {
|
if (['collection-settings', 'folder-settings', 'variables', 'collection-runner'].includes(tab.type)) {
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user