mattermost-mobile/app/client/rest/categories.ts
Shaz Amjad 9f5f73b264
Gekidou - Sidebar - Adds actions, queries, db models and rest client (#5953)
* Adds actions, queries, db models and rest client

* move fetching categories inside fetchMyChannelsForTeam

* code cleanup

* deconstruct categoriesWithOrder

* DMs fetching for changing teams

* Fix bad merge and address feedback

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2022-02-11 18:40:44 -03:00

31 lines
1.1 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
export interface ClientCategoriesMix {
getCategories: (userId: string, teamId: string) => Promise<CategoriesWithOrder>;
getCategoriesOrder: (userId: string, teamId: string) => Promise<string[]>;
getCategory: (userId: string, teamId: string, categoryId: string) => Promise<Category>;
}
const ClientCategories = (superclass: any) => class extends superclass {
getCategories = async (userId: string, teamId: string) => {
return this.doFetch(
`${this.getCategoriesRoute(userId, teamId)}`,
{method: 'get'},
);
};
getCategoriesOrder = async (userId: string, teamId: string) => {
return this.doFetch(
`${this.getCategoriesOrderRoute(userId, teamId)}`,
{method: 'get'},
);
};
getCategory = async (userId: string, teamId: string, categoryId: string) => {
return this.doFetch(
`${this.getCategoryRoute(userId, teamId, categoryId)}`,
{method: 'get'},
);
};
};
export default ClientCategories;