mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: add notifications
This commit is contained in:
1 parent
39d6b1f045
commit
bbef22b1d5
7 files changed
+43
-6
No files matched your search
@@ -1,6 +1,12 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
|
||||
export type AuthMethod = {
|
||||
label: string;
|
||||
method: string;
|
||||
value: boolean | null;
|
||||
};
|
||||
|
||||
function createAuthMethods() {
|
||||
const { subscribe, set } = writable({
|
||||
list: [
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
secret
|
||||
);
|
||||
showModal = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${provider.name} authentication has been ${
|
||||
provider.active ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
secret
|
||||
);
|
||||
showModal = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${provider.name} authentication has been ${
|
||||
provider.active ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
provider.secret
|
||||
);
|
||||
showModal = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${provider.name} authentication has been ${
|
||||
provider.active ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
);
|
||||
|
||||
showModal = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${provider.name} authentication has been ${
|
||||
provider.active ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
|
||||
@@ -28,8 +28,13 @@
|
||||
provider.id,
|
||||
secret
|
||||
);
|
||||
|
||||
showModal = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${provider.name} authentication has been ${
|
||||
provider.active ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { project } from '../store';
|
||||
import { authMethods } from '$lib/stores/auth-methods';
|
||||
import { authMethods, type AuthMethod } from '$lib/stores/auth-methods';
|
||||
import { OAuthProviders } from '$lib/stores/oauth-providers';
|
||||
import { event } from '$lib/actions/analytics';
|
||||
import type { Provider } from '$lib/stores/oauth-providers';
|
||||
@@ -17,12 +17,14 @@
|
||||
$: OAuthProviders.load($project);
|
||||
let showModal = false;
|
||||
|
||||
const authUpdate = async (id: string, value: boolean) => {
|
||||
const authUpdate = async (box: AuthMethod) => {
|
||||
try {
|
||||
await sdkForConsole.projects.updateAuthStatus(projectId, id, value);
|
||||
await sdkForConsole.projects.updateAuthStatus(projectId, box.method, box.value);
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: 'Updated project authentication status successfully'
|
||||
message: `${box.label} authentication has been ${
|
||||
box.value ? 'enabled' : 'disabled'
|
||||
}`
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
@@ -50,7 +52,7 @@
|
||||
id={box.method}
|
||||
bind:value={box.value}
|
||||
on:change={() => {
|
||||
authUpdate(box.method, box.value);
|
||||
authUpdate(box);
|
||||
}} />
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
Reference in new issue
Block a user