mirror of
https://github.com/JonasunderscoreJones/dash.jonasjones.dev.git
synced 2025-10-22 18:29:19 +02:00
moved accounts backend to session lib
This commit is contained in:
parent
10cc36000c
commit
e5c9c351e7
3 changed files with 7 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
|||
export const ACCOUNTS_WORKER_URL = 'https://accounts.jonasjones.dev';
|
||||
|
||||
export function getSessionKey() {
|
||||
const match = document.cookie.match(/(^| )sessionKey=([^;]+)/);
|
||||
return match ? match[2] : null;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script>
|
||||
import { navigate } from 'svelte-routing';
|
||||
import { setSessionKey } from '$lib/session.js';
|
||||
import { onMount } from 'svelte';
|
||||
import { setSessionKey, ACCOUNTS_WORKER_URL } from '$lib/session.js';
|
||||
import { page } from '$app/state';
|
||||
let email = '';
|
||||
let password = '';
|
||||
|
@ -9,7 +10,7 @@
|
|||
|
||||
const handleLogin = async () => {
|
||||
try {
|
||||
const response = await fetch('https://accounts.jonasjones.dev/login', {
|
||||
const response = await fetch(ACCOUNTS_WORKER_URL + '/login', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ email, password }),
|
||||
headers: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { navigate } from 'svelte-routing';
|
||||
import { setSessionKey } from '$lib/session.js';
|
||||
import { setSessionKey, ACCOUNTS_WORKER_URL } from '$lib/session.js';
|
||||
import { page } from '$app/state';
|
||||
let username = '';
|
||||
let firstname = '';
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
const handleLogin = async () => {
|
||||
try {
|
||||
const response = await fetch('https://accounts.jonasjones.dev/register', {
|
||||
const response = await fetch(ACCOUNTS_WORKER_URL + '/register', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ email, password, username, firstname, lastname }),
|
||||
headers: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue