replace localhost + checkLoggedIn + fix register/login links
This commit is contained in:
parent
00aac119f1
commit
a3cd614c61
4 changed files with 29 additions and 17 deletions
|
@ -4,11 +4,14 @@
|
|||
import {
|
||||
ID,
|
||||
account,
|
||||
checkloggedin,
|
||||
database,
|
||||
loggedInUser,
|
||||
teams,
|
||||
} from "../../lib/appwrite";
|
||||
import { navigate } from "svelte-navigator/src/history";
|
||||
import { navigate } from "svelte-navigator/src/history";
|
||||
|
||||
checkloggedin();
|
||||
|
||||
let listname = "";
|
||||
let requireLoggedIn = false;
|
||||
|
@ -27,23 +30,25 @@
|
|||
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(
|
||||
"tehillim-split",
|
||||
"lists",
|
||||
r["$id"],
|
||||
{},
|
||||
permissions,
|
||||
).then(() => {
|
||||
navigate('/list/' + r["$id"], {});
|
||||
});
|
||||
database
|
||||
.updateDocument(
|
||||
"tehillim-split",
|
||||
"lists",
|
||||
r["$id"],
|
||||
{},
|
||||
permissions,
|
||||
)
|
||||
.then(() => {
|
||||
navigate("/list/" + r["$id"], {});
|
||||
});
|
||||
});
|
||||
console.log(r);
|
||||
});
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue