-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a24f41b
commit c1d25b3
Showing
16 changed files
with
778 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ logs | |
# sample file | ||
sample/* | ||
.vscode/settings.json | ||
secrets/pg.env |
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { string, object, email, minLength, Input } from "valibot"; | ||
import type { FormSubmitEvent } from "@nuxt/ui/dist/runtime/types"; | ||
const schema = object({ | ||
email: string([email("Invalid email")]), | ||
password: string([minLength(8, "Must be at least 8 characters")]) | ||
}); | ||
type Schema = Input<typeof schema> | ||
const state = ref({ | ||
email: undefined, | ||
password: undefined | ||
}); | ||
async function submit (event: FormSubmitEvent<Schema>) { | ||
// Do something with event.data | ||
console.log(event.data); | ||
console.log(state); | ||
const result = await $fetch("/api/checkLogin", { | ||
method:"POST", | ||
body:{email:state.value.email, password:state.value.password} | ||
}); | ||
console.log(result); | ||
} | ||
</script> | ||
|
||
<template> | ||
<UContainer class="flex justify-around items-center"> | ||
<UForm | ||
class="form" | ||
:schema="schema" | ||
:state="state" | ||
@submit="submit" | ||
> | ||
<UFormGroup | ||
label="Email" | ||
name="email" | ||
> | ||
<UInput v-model="state.email" /> | ||
</UFormGroup> | ||
|
||
<UFormGroup | ||
label="Password" | ||
name="password" | ||
> | ||
<UInput | ||
v-model="state.password" | ||
type="password" | ||
/> | ||
</UFormGroup> | ||
|
||
<UButton type="submit"> | ||
Submit | ||
</UButton> | ||
</UForm> | ||
</UContainer> | ||
</template> | ||
|
||
<style> | ||
.form { | ||
justify-content: center; | ||
width: 50%; | ||
} | ||
</style> | ||
|
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
-- CREATE USER ep2m2 WITH PASSWORD 'ep2m2'; | ||
CREATE DATABASE ep2m2db; | ||
GRANT ALL PRIVILEGES ON DATABASE ep2m2db TO ep2m2; | ||
|
||
\c ep2m2db ep2m2 | ||
|
||
CREATE TABLE verification_token | ||
( | ||
identifier TEXT NOT NULL, | ||
expires TIMESTAMPTZ NOT NULL, | ||
token TEXT NOT NULL, | ||
|
||
PRIMARY KEY (identifier, token) | ||
); | ||
|
||
CREATE TABLE accounts | ||
( | ||
id SERIAL, | ||
"userId" INTEGER NOT NULL, | ||
type VARCHAR(255) NOT NULL, | ||
provider VARCHAR(255) NOT NULL, | ||
"providerAccountId" VARCHAR(255) NOT NULL, | ||
refresh_token TEXT, | ||
access_token TEXT, | ||
expires_at BIGINT, | ||
id_token TEXT, | ||
scope TEXT, | ||
session_state TEXT, | ||
token_type TEXT, | ||
|
||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE sessions | ||
( | ||
id SERIAL, | ||
"userId" INTEGER NOT NULL, | ||
expires TIMESTAMPTZ NOT NULL, | ||
"sessionToken" VARCHAR(255) NOT NULL, | ||
|
||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE users | ||
( | ||
id SERIAL, | ||
name VARCHAR(255), | ||
lastname VARCHAR(255), | ||
email VARCHAR(255), | ||
"emailVerified" TIMESTAMPTZ, | ||
hash VARCHAR(255), | ||
image TEXT, | ||
|
||
PRIMARY KEY (id) | ||
); |
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
Oops, something went wrong.