replace localhost + checkLoggedIn + fix register/login links

This commit is contained in:
Dovi Cowan 2023-10-20 15:42:17 +01:00
parent 00aac119f1
commit a3cd614c61
Signed by: dcowan
GPG key ID: C110D77558FBC227
4 changed files with 29 additions and 17 deletions

View file

@ -4,12 +4,15 @@
import {
ID,
account,
checkloggedin,
database,
loggedInUser,
teams,
} from "../../lib/appwrite";
import { navigate } from "svelte-navigator/src/history";
checkloggedin();
let listname = "";
let requireLoggedIn = false;
@ -27,22 +30,24 @@
let permissions = [
Permission.read(Role.user(loggedInUser["$id"])),
Permission.read(Role.team(r["$id"])),
Permission.write(Role.team(r["$id"], 'owner')),
Permission.delete(Role.team(r["$id"], 'owner'))
Permission.write(Role.team(r["$id"], "owner")),
Permission.delete(Role.team(r["$id"], "owner")),
];
if (requireLoggedIn == false) {
permissions.push(Permission.read(Role.any()));
}
database.updateDocument(
database
.updateDocument(
"tehillim-split",
"lists",
r["$id"],
{},
permissions,
).then(() => {
navigate('/list/' + r["$id"], {});
)
.then(() => {
navigate("/list/" + r["$id"], {});
});
});
console.log(r);

View file

@ -1,7 +1,14 @@
<script>
import { Link } from "svelte-navigator";
import Header from "../../lib/Header.svelte";
import { database, loggedInUser, teams } from "../../lib/appwrite";
import {
checkloggedin,
database,
loggedInUser,
teams,
} from "../../lib/appwrite";
checkloggedin();
export let id;
@ -35,7 +42,7 @@
email,
undefined,
undefined,
"http://localhost:5173/accept_list_invitation",
window.location.protocol + "//" + window.location.host + "/accept_list_invitation",
)
.then(() => getData());
}

View file

@ -82,7 +82,7 @@
type="button"
to="/register{urlParams.get('redirect_uri') !== null
? '?redirect_uri=' + encodeURIComponent(urlParams.get('redirect_uri'))
: undefined}">Go to Register</Link
: ''}">Go to Register</Link
><br />
<p class="text-red-600" bind:this={error}></p>
</fieldset>

View file

@ -22,7 +22,7 @@
await account.updateName(name).catch((e) => (error.innerText = e));
account
.createVerification("http://localhost:5173/register/emailVerify")
.createVerification(window.location.protocol + "//" + window.location.host + "/register/emailVerify")
.then((r) => {
if (urlParams.get("redirect_uri") == null) {
navigate("/", {});
@ -79,7 +79,7 @@
type="button"
to="/login{urlParams.get('redirect_uri') !== null
? '?redirect_uri=' + encodeURIComponent(urlParams.get('redirect_uri'))
: undefined}">Go to Log In</Link
: ''}">Go to Log In</Link
><br />
<p class="text-red-600" bind:this={error}></p>
</fieldset>