-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from TheWisePigeon/49-refactor-keys-creation
Refactor keys creation
- Loading branch information
Showing
8 changed files
with
94 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,45 @@ | ||
<!-- This is a dummy file for testing key functionality --> | ||
|
||
<head> | ||
<title>Key Auth</title> | ||
<title>Visio | Keys</title> | ||
</head> | ||
|
||
<main x-data="init()"> | ||
<section class="p-12"> | ||
<button class="border bg-black text-white p-2 rounded-md w-32 text-center" @click="createKey" | ||
type="button">Create | ||
API key</button> | ||
<button class="border p-2 rounded-md w-32 text-center">Revoke API key</button> | ||
</section> | ||
<!-- <div class="absolute"> --> | ||
<!-- <h1>This is your key</h1> --> | ||
<!-- </div> --> | ||
<div class="w-full flex justify-between mt-5 items-baseline"> | ||
<h1 class="text-xl font-bold">Manage your API keys</h1> | ||
<button x-bind:disabled="creating_key" @click="createKey" class="w-32 p-2 bg-black text-white rounded-md" | ||
type="button"> | ||
<h1 x-show="!creating_key">New Key</h1> | ||
<h1 x-show="creating_key">Creating...</h1> | ||
</button> | ||
</div> | ||
</main> | ||
|
||
|
||
<script> | ||
function init() { | ||
return { | ||
createKey: async function () { | ||
try { | ||
console.log("Creating key") | ||
const response = await fetch( | ||
`/api/key`, | ||
{ | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
) | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
function init() { | ||
return { | ||
creating_key: false, | ||
createKey: async function () { | ||
creating_key = true | ||
try { | ||
console.log("Creating key") | ||
const response = await fetch( | ||
`/api/key`, | ||
{ | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
} | ||
) | ||
creating_key = false | ||
console.log(response.status) | ||
} catch (err) { | ||
alert("Something went wrong. Please retry or contact us") | ||
console.log(err) | ||
} | ||
} | ||
} | ||
</script> | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="stylesheet" type="" href="/public/output.css"> | ||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script> | ||
</head> | ||
|
||
<body class="w-full h-screen "> | ||
<main class="m-auto w-full p-2 lg:w-[50%] "> | ||
<nav class="w-full flex justify-between items-baseline border-b-2 "> | ||
<h1 class="text-2xl">VISIO</h1> | ||
<div class="flex gap-5"> | ||
<a class="hover:underline" target="_blank" rel="noreferrer" href="https://github.com/TheWisePigeon/visio"> | ||
<h1>GitHub</h1> | ||
</a> | ||
<a class="hover:underline" target="_blank" rel="noreferrer" href="https://discord.gg/DsGc5EvQ"> | ||
<h1>Discord</h1> | ||
</a> | ||
</div> | ||
</nav> | ||
{{embed}} | ||
</main> | ||
</body> | ||
|
||
</html> |