20 lines
487 B
TypeScript
20 lines
487 B
TypeScript
import Cookies from "js-cookie";
|
|
import { myToast } from "./toastify";
|
|
|
|
export const changeAPIcookie = (newApiKey: string) => {
|
|
let apiKey15 = newApiKey.slice(0, 15);
|
|
Cookies.set("apiKey", newApiKey);
|
|
if (Cookies.get("apiKey") === newApiKey) {
|
|
myToast(
|
|
"API key updated successfully!" +
|
|
" " +
|
|
"Your new API key: " +
|
|
apiKey15 +
|
|
"...",
|
|
"success"
|
|
);
|
|
} else {
|
|
myToast("Failed to update API key. (Error: x30)", "error");
|
|
}
|
|
};
|