diff --git a/front/src/pages/account/login.astro b/front/src/pages/account/login.astro deleted file mode 100644 index 80be112..0000000 --- a/front/src/pages/account/login.astro +++ /dev/null @@ -1,46 +0,0 @@ ---- -import Layout from "../../layouts/Layout.astro"; -import PocketBase from 'pocketbase'; -import AstroUtils from "../../libs/AstroUtils"; -// import Schema from 'models/Schema' - - -// const usr = await getUser(Astro.cookies) -// if (usr) { -// return Astro.redirect(route('/', {message: 'Vous êtes déjà connecté !'})) -// } - - -const res = await AstroUtils.wrap(async () => { - if (Astro.request.method !== 'POST') { - return - } - const form = await Astro.request.formData(); - const request = { - email: form.get("username") as string, - password: form.get("password") as string, - } - const pb = new PocketBase('http://127.0.0.1:3001'); - - const authData = await pb.collection('users').authWithPassword( - request.email, - request.password, - ); - - // after the above you can also access the auth data from the authStore - console.log(pb.authStore.isValid); - console.log(pb.authStore.token); - if(pb.authStore.model){ - console.log(pb.authStore.model.id); - } - -}) ---- - - -
- - - -
-
\ No newline at end of file diff --git a/front/src/pages/account/register.astro b/front/src/pages/account/register.astro deleted file mode 100644 index 9b08d6d..0000000 --- a/front/src/pages/account/register.astro +++ /dev/null @@ -1,45 +0,0 @@ ---- -import PocketBase from 'pocketbase'; -import Layout from '../../layouts/Layout.astro'; -import AstroUtils from '../../libs/AstroUtils'; - -//const connected = await getUser(Astro.cookies) - -// if(connected) { -// return Astro.redirect(route('/')) -// } - - -const res = await AstroUtils.wrap(async () => { - if (Astro.request.method !== 'POST'){ - return - } - const form = await Astro.request.formData() - const request = { - username: form.get("username") as String, - name: form.get("name") as String, - email: form.get("email") as String, - password: form.get("password") as String, - passwordConfirm: form.get("passwordConfirm") as String, - emailVisibility: false - } - const pb = new PocketBase('http://127.0.0.1:3001'); - - console.log(request); - const record = await pb.collection('users').create(request); - console.log(record); - -}) -return res ---- - - -
- - - - - - -
-
\ No newline at end of file diff --git a/front/src/pages/welcome.astro b/front/src/pages/index.astro similarity index 100% rename from front/src/pages/welcome.astro rename to front/src/pages/index.astro