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:
Sushant Kumar 2024-08-19 23:10:52 +10:00 committed by GitHub
parent 77750ecc0b
commit d3e57d0ea6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,43 +62,9 @@ const RequestTab = ({ tab, collection, tabIndex, collectionRequestTabs, folderUi
const getMethodColor = (method = '') => {
const theme = storedTheme === 'dark' ? darkTheme : lightTheme;
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;
return theme.request.methods[method.toLocaleLowerCase()];
};
const folder = folderUid ? findItemInCollection(collection, folderUid) : null;
if (['collection-settings', 'folder-settings', 'variables', 'collection-runner'].includes(tab.type)) {
return (