chore: formatting

This commit is contained in:
Timothy J. Baek 2024-04-02 09:33:27 -07:00
parent da8646cae9
commit e49e04c56a
2 changed files with 31 additions and 18 deletions

View file

@ -342,7 +342,7 @@ export const createApiKey = async (token: string) => {
throw error; throw error;
} }
return res; return res;
} };
export const getApiKey = async (token: string) => { export const getApiKey = async (token: string) => {
let error = null; let error = null;
@ -367,7 +367,7 @@ export const getApiKey = async (token: string) => {
throw error; throw error;
} }
return res; return res;
} };
export const deleteApiKey = async (token: string) => { export const deleteApiKey = async (token: string) => {
let error = null; let error = null;
@ -392,4 +392,4 @@ export const deleteApiKey = async (token: string) => {
throw error; throw error;
} }
return res; return res;
} };

View file

@ -39,12 +39,11 @@
const createApiKeyHandler = async () => { const createApiKeyHandler = async () => {
const apiKey = await createApiKey(localStorage.token); const apiKey = await createApiKey(localStorage.token);
if (apiKey) { if (apiKey) {
localApiKey = apiKey["api_key"]; localApiKey = apiKey['api_key'];
localStorage.apiKey = localApiKey; localStorage.apiKey = localApiKey;
toast.success($i18n.t('API Key created.')); toast.success($i18n.t('API Key created.'));
} else { } else {
toast.error($i18n.t('Failed to create API Key.')); toast.error($i18n.t('Failed to create API Key.'));
} }
}; };
@ -299,14 +298,6 @@
disabled disabled
/> />
<button
class="ml-1.5 px-1.5 py-1 hover:bg-gray-800 transition rounded-lg"
on:click={() => {createApiKeyHandler()}}
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="w-4 h-4"><path d="M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z"></path></svg>
</button>
<button <button
class="px-2 transition rounded-r-lg dark:bg-gray-800" class="px-2 transition rounded-r-lg dark:bg-gray-800"
on:click={() => { on:click={() => {
@ -390,6 +381,28 @@
</svg> </svg>
{/if} {/if}
</button> </button>
<button
class=" px-1.5 py-1 hover:bg-gray-800 transition rounded-lg"
on:click={() => {
createApiKeyHandler();
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
class="size-4"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"
/>
</svg>
</button>
</div> </div>
</div> </div>
</div> </div>