sliftutils 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/misc/apiKeys.d.ts +1 -0
- package/misc/apiKeys.tsx +7 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare module "sliftutils/misc/apiKeys" {
|
|
|
14
14
|
getAllKeys(): string[];
|
|
15
15
|
get(key: string): Promise<string> | undefined;
|
|
16
16
|
};
|
|
17
|
+
export declare function setAPIKey(key: string, value: string): void;
|
|
17
18
|
export declare class ManageAPIKeys extends preact.Component {
|
|
18
19
|
render(): string;
|
|
19
20
|
}
|
package/misc/apiKeys.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const getAPIKey: {
|
|
|
10
10
|
getAllKeys(): string[];
|
|
11
11
|
get(key: string): Promise<string> | undefined;
|
|
12
12
|
};
|
|
13
|
+
export declare function setAPIKey(key: string, value: string): void;
|
|
13
14
|
export declare class ManageAPIKeys extends preact.Component {
|
|
14
15
|
render(): string;
|
|
15
16
|
}
|
package/misc/apiKeys.tsx
CHANGED
|
@@ -128,15 +128,19 @@ export const getAPIKey = cache(async function getAPIKey(key: string): Promise<st
|
|
|
128
128
|
try {
|
|
129
129
|
let value = await promise;
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
state.keys.push(key);
|
|
133
|
-
getStorage().setItem(getStorageKey("__keys"), JSON.stringify(state.keys));
|
|
131
|
+
setAPIKey(key, value);
|
|
134
132
|
return value;
|
|
135
133
|
} finally {
|
|
136
134
|
obj.close();
|
|
137
135
|
}
|
|
138
136
|
});
|
|
139
137
|
|
|
138
|
+
export function setAPIKey(key: string, value: string) {
|
|
139
|
+
getStorage().setItem(getStorageKey(key), value);
|
|
140
|
+
state.keys.push(key);
|
|
141
|
+
getStorage().setItem(getStorageKey("__keys"), JSON.stringify(state.keys));
|
|
142
|
+
}
|
|
143
|
+
|
|
140
144
|
@observer
|
|
141
145
|
export class ManageAPIKeys extends preact.Component {
|
|
142
146
|
render() {
|