diff --git a/src/lib/stores/auth-methods.ts b/src/lib/stores/auth-methods.ts index 8ca530178..b4fbd07b9 100644 --- a/src/lib/stores/auth-methods.ts +++ b/src/lib/stores/auth-methods.ts @@ -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: [ diff --git a/src/routes/console/[project]/authentication/_appleOAuth.svelte b/src/routes/console/[project]/authentication/_appleOAuth.svelte index 157ce1900..f7e18291b 100644 --- a/src/routes/console/[project]/authentication/_appleOAuth.svelte +++ b/src/routes/console/[project]/authentication/_appleOAuth.svelte @@ -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', diff --git a/src/routes/console/[project]/authentication/_auth0OAuth.svelte b/src/routes/console/[project]/authentication/_auth0OAuth.svelte index ee16907db..7baa58b4d 100644 --- a/src/routes/console/[project]/authentication/_auth0OAuth.svelte +++ b/src/routes/console/[project]/authentication/_auth0OAuth.svelte @@ -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', diff --git a/src/routes/console/[project]/authentication/_mainOAuth.svelte b/src/routes/console/[project]/authentication/_mainOAuth.svelte index 85677ab84..f874c8198 100644 --- a/src/routes/console/[project]/authentication/_mainOAuth.svelte +++ b/src/routes/console/[project]/authentication/_mainOAuth.svelte @@ -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', diff --git a/src/routes/console/[project]/authentication/_microsoftOAuth.svelte b/src/routes/console/[project]/authentication/_microsoftOAuth.svelte index 432e54569..fc3bff73a 100644 --- a/src/routes/console/[project]/authentication/_microsoftOAuth.svelte +++ b/src/routes/console/[project]/authentication/_microsoftOAuth.svelte @@ -29,6 +29,12 @@ ); showModal = false; + addNotification({ + type: 'success', + message: `${provider.name} authentication has been ${ + provider.active ? 'enabled' : 'disabled' + }` + }); } catch (error) { addNotification({ type: 'error', diff --git a/src/routes/console/[project]/authentication/_oktaOAuth.svelte b/src/routes/console/[project]/authentication/_oktaOAuth.svelte index 32bb06db6..fb32e4b64 100644 --- a/src/routes/console/[project]/authentication/_oktaOAuth.svelte +++ b/src/routes/console/[project]/authentication/_oktaOAuth.svelte @@ -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', diff --git a/src/routes/console/[project]/authentication/settings.svelte b/src/routes/console/[project]/authentication/settings.svelte index d30450a32..41972c7d3 100644 --- a/src/routes/console/[project]/authentication/settings.svelte +++ b/src/routes/console/[project]/authentication/settings.svelte @@ -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}