prototype subdeck from Kanji
This commit is contained in:
1 parent
f427a8e148
commit
13f2bb421c
4 files changed
+148
-84
No files matched your search
@@ -42,3 +42,7 @@ export interface IAnkiTemplate {
|
||||
bqfmt: string;
|
||||
bamt: string;
|
||||
}
|
||||
|
||||
export interface IAnkiDeckConfig {
|
||||
id: number;
|
||||
}
|
||||
+19
-1
@@ -1,6 +1,7 @@
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
|
||||
import { IAnkiCard, IAnkiQuery } from './anki';
|
||||
import { IAnkiCard, IAnkiDeckConfig, IAnkiQuery } from './anki';
|
||||
import { logger } from './logger';
|
||||
|
||||
export interface IAnkiConnectActions
|
||||
extends Record<
|
||||
@@ -67,6 +68,19 @@ export interface IAnkiConnectActions
|
||||
};
|
||||
result: null;
|
||||
};
|
||||
getDeckConfig: {
|
||||
params: {
|
||||
deck: string;
|
||||
};
|
||||
result: IAnkiDeckConfig;
|
||||
};
|
||||
setDeckConfigId: {
|
||||
params: {
|
||||
decks: string[];
|
||||
configId: number;
|
||||
};
|
||||
result: boolean;
|
||||
};
|
||||
|
||||
// Media Actions
|
||||
storeMediaFile: {
|
||||
@@ -443,6 +457,8 @@ export class AnkiConnect {
|
||||
params: IAnkiConnectActions[A]['params'],
|
||||
version = this.version,
|
||||
): Promise<IAnkiConnectActions[A]['result']> {
|
||||
logger(`AnkiConnect: calling ${action}`, params);
|
||||
|
||||
const { data: response } = await this.$axios.post<{
|
||||
result: any;
|
||||
error: string | null;
|
||||
@@ -461,6 +477,8 @@ export class AnkiConnect {
|
||||
throw response.error;
|
||||
}
|
||||
|
||||
logger(`AnkiConnect: finished ${action}`, params);
|
||||
|
||||
return response.result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export function logger(...args: any[]) {
|
||||
if (process.env['DEBUG']) {
|
||||
console.debug(...args);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user