Skip to content

Commit

Permalink
[MM-769]: Convert some JS files to TS and removed unused codes (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kshitij-Katiyar authored Oct 24, 2024
1 parent 85725f3 commit e9a9da4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
File renamed without changes.
15 changes: 12 additions & 3 deletions webapp/src/client/index.js → webapp/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
import {Client4} from 'mattermost-redux/client';
import {ClientError} from 'mattermost-redux/client/client4';

export const doFetch = async (url, options) => {
interface QueryParameters {
[key: string]: string | number | boolean;
}

interface FetchOptions {
method: string;
body?: BodyInit | null;
}

export const doFetch = async (url: string, options: FetchOptions) => {
const {data} = await doFetchWithResponse(url, options);

return data;
};

export const doFetchWithResponse = async (url, options = {}) => {
export const doFetchWithResponse = async (url: string, options = {}) => {
const response = await fetch(url, Client4.getOptions(options));

let data;
Expand All @@ -32,7 +41,7 @@ export const doFetchWithResponse = async (url, options = {}) => {
});
};

export function buildQueryString(parameters) {
export function buildQueryString(parameters: QueryParameters) {
const keys = Object.keys(parameters);
if (keys.length === 0) {
return '';
Expand Down
13 changes: 0 additions & 13 deletions webapp/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,6 @@ const channelSubscriptions = (state = {}, action) => {
}
};

const storedLinkTooltipIssue = (state = {}, action) => {
switch (action.type) {
case ActionTypes.RECEIVED_JIRA_TICKET : {
return {
ticket: action.data,
};
}
default:
return state;
}
};

export default combineReducers({
userConnected,
userCanConnect,
Expand All @@ -220,5 +208,4 @@ export default combineReducers({
attachCommentToIssueModalForPostId,
channelIdWithSettingsOpen,
channelSubscriptions,
storedLinkTooltipIssue,
});
2 changes: 0 additions & 2 deletions webapp/src/selectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,3 @@ export const instanceIsInstalled = (state): boolean => getInstalledInstances(sta
export const getDefaultUserInstanceID = (state) => getPluginState(state).defaultUserInstanceID;

export const getPluginSettings = (state) => getPluginState(state).pluginSettings;

export const getStoredLinkTooltipIssue = (state) => getPluginState(state).storedLinkTooltipIssue;

0 comments on commit e9a9da4

Please sign in to comment.