2023-10-02 23:10:49 +03:00
|
|
|
<script>
|
2026-05-07 22:50:02 +03:00
|
|
|
import { apiPost } from "../../helpers";
|
2023-10-02 23:10:49 +03:00
|
|
|
import ErrorAlert from "../common/ErrorAlert.svelte";
|
|
|
|
|
import SpinnerButton from "../common/SpinnerButton.svelte";
|
2026-05-07 22:50:02 +03:00
|
|
|
import { getContext } from "svelte";
|
2023-10-02 23:10:49 +03:00
|
|
|
|
2023-10-04 13:32:30 +03:00
|
|
|
const channel = getContext("channel");
|
2023-10-02 23:10:49 +03:00
|
|
|
let name = "";
|
|
|
|
|
export let email = "";
|
|
|
|
|
let errorMessage = "";
|
|
|
|
|
|
|
|
|
|
function register(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
errorMessage = "";
|
|
|
|
|
|
2026-05-07 22:50:02 +03:00
|
|
|
apiPost(channel.lucentUrl + "/register", {
|
|
|
|
|
name: name,
|
|
|
|
|
email: email,
|
|
|
|
|
})
|
2023-10-02 23:10:49 +03:00
|
|
|
.then(() => {
|
2023-10-04 13:32:30 +03:00
|
|
|
window.location = channel.lucentUrl + "/login";
|
2023-10-02 23:10:49 +03:00
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
errorMessage = error.response?.data.error;
|
2026-05-07 22:50:02 +03:00
|
|
|
console.log({ errorMessage });
|
2023-10-02 23:10:49 +03:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="wrapper-tiny">
|
2026-05-07 22:50:02 +03:00
|
|
|
<ErrorAlert message={errorMessage} />
|
2023-10-02 23:10:49 +03:00
|
|
|
|
2023-10-04 13:32:30 +03:00
|
|
|
<form on:submit={register}>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="name" class="form-label">Name</label>
|
|
|
|
|
<input
|
2026-05-07 22:50:02 +03:00
|
|
|
type="text"
|
|
|
|
|
bind:value={name}
|
|
|
|
|
class="form-control"
|
|
|
|
|
id="name"
|
2023-10-04 13:32:30 +03:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="email" class="form-label">Email address</label>
|
|
|
|
|
<input
|
2026-05-07 22:50:02 +03:00
|
|
|
type="email"
|
|
|
|
|
bind:value={email}
|
|
|
|
|
class="form-control"
|
|
|
|
|
id="email"
|
2023-10-04 13:32:30 +03:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="text-center mt-5 d-block">
|
2026-05-07 22:50:02 +03:00
|
|
|
<SpinnerButton label="Register" />
|
2023-10-04 13:32:30 +03:00
|
|
|
</div>
|
|
|
|
|
</form>
|
2023-10-02 23:10:49 +03:00
|
|
|
</div>
|