mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: improve loading
This commit is contained in:
1 parent
afb9dee767
commit
37878554df
4 files changed
+17
-14
No files matched your search
@@ -15,6 +15,7 @@
|
||||
let id: string;
|
||||
let showCustomId = false;
|
||||
let loading = false;
|
||||
|
||||
async function createProject() {
|
||||
try {
|
||||
loading = true;
|
||||
@@ -28,12 +29,11 @@
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
goto(`/console/project-${project.$id}`);
|
||||
} catch ({ message }) {
|
||||
loading = false;
|
||||
addNotification({
|
||||
message,
|
||||
type: 'error'
|
||||
});
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
let error: string;
|
||||
let isCreating = false;
|
||||
|
||||
const create = async () => {
|
||||
async function create() {
|
||||
try {
|
||||
isCreating = true;
|
||||
const project = await sdkForConsole.projects.create(
|
||||
@@ -34,11 +34,10 @@
|
||||
});
|
||||
await goto(`/console/project-${project.$id}`);
|
||||
} catch ({ message }) {
|
||||
error = message;
|
||||
} finally {
|
||||
isCreating = false;
|
||||
error = message;
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal {error} on:submit={create} size="big" bind:show>
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
import { Unauthenticated } from '$lib/layout';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
let mail: string, pass: string;
|
||||
let mail: string, pass: string, disabled: boolean;
|
||||
|
||||
const login = async () => {
|
||||
async function login() {
|
||||
try {
|
||||
disabled = true;
|
||||
await sdkForConsole.account.createEmailSession(mail, pass);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
addNotification({
|
||||
@@ -26,12 +27,13 @@
|
||||
});
|
||||
await goto(`${base}/console`);
|
||||
} catch (error) {
|
||||
disabled = false;
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -59,7 +61,7 @@
|
||||
showPasswordButton={true}
|
||||
bind:value={pass} />
|
||||
<FormItem>
|
||||
<Button fullWidth submit>Sign in</Button>
|
||||
<Button fullWidth submit {disabled}>Sign in</Button>
|
||||
</FormItem>
|
||||
</FormList>
|
||||
</Form>
|
||||
|
||||
@@ -16,22 +16,24 @@
|
||||
import FormList from '$lib/elements/forms/formList.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
let name: string, mail: string, pass: string;
|
||||
let name: string, mail: string, pass: string, disabled: boolean;
|
||||
let terms = false;
|
||||
|
||||
const register = async () => {
|
||||
async function register() {
|
||||
try {
|
||||
disabled = true;
|
||||
await sdkForConsole.account.create('unique()', mail, pass, name ?? '');
|
||||
await sdkForConsole.account.createEmailSession(mail, pass);
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await goto(`${base}/console`);
|
||||
} catch (error) {
|
||||
disabled = false;
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -77,7 +79,7 @@
|
||||
rel="noopener noreferrer">General Terms of Use</a
|
||||
>.</InputChoice>
|
||||
<FormItem>
|
||||
<Button fullWidth submit>Sign up</Button>
|
||||
<Button fullWidth submit {disabled}>Sign up</Button>
|
||||
</FormItem>
|
||||
</FormList>
|
||||
</Form>
|
||||
|
||||
Reference in new issue
Block a user