1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-22 22:59:41 +02:00

refactor(frontend): 🔥 rewrite backup UI for new page base components

Removed old split code and used the composition api to to re-write the import/export functionality of mealie.
This commit is contained in:
hay-kot 2021-08-21 00:46:43 -08:00
parent 460f508f79
commit edae7bbb21
25 changed files with 535 additions and 759 deletions

View file

@ -12,6 +12,10 @@ interface CreateAPIToken {
name: string;
}
interface ResponseToken {
token: string;
}
// Code
const prefix = "/api";
@ -28,7 +32,7 @@ const routes = {
usersIdFavoritesSlug: (id: string, slug: string) => `${prefix}/users/${id}/favorites/${slug}`,
usersApiTokens: `${prefix}/users/api-tokens`,
usersApiTokensTokenId: (token_id: string) => `${prefix}/users/api-tokens/${token_id}`,
usersApiTokensTokenId: (token_id: string | number) => `${prefix}/users/api-tokens/${token_id}`,
};
export class UserApi extends BaseCRUDAPI<UserOut, UserIn> {
@ -56,10 +60,10 @@ export class UserApi extends BaseCRUDAPI<UserOut, UserIn> {
}
async createAPIToken(tokenName: CreateAPIToken) {
return await this.requests.post(routes.usersApiTokens, tokenName);
return await this.requests.post<ResponseToken>(routes.usersApiTokens, tokenName);
}
async deleteApiToken(tokenId: string) {
async deleteAPIToken(tokenId: string | number) {
return await this.requests.delete(routes.usersApiTokensTokenId(tokenId));
}