Merge branch 'users' of github.com:appwrite/appwrite-console-poc into storage

This commit is contained in:
Arman
2022-07-04 16:43:58 +02:00
9 changed files with 85 additions and 81 deletions
+71
View File
@@ -0,0 +1,71 @@
import { writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
function createAuthMethods() {
const { subscribe, set } = writable({
list: [
{
label: 'Password',
method: 'email-password',
value: null
},
{
label: 'Magic URL',
method: 'magic-url',
value: null
},
{
label: 'Anonymous',
method: 'anonymous',
value: null
},
{
label: 'Invites',
method: 'invites',
value: null
},
{
label: 'JWT',
method: 'jwt',
value: null
}
]
});
return {
subscribe,
set,
load: (project: Models.Project) => {
const list = [
{
label: 'Password',
method: 'email-password',
value: project.authEmailPassword
},
{
label: 'Magic URL',
method: 'magic-url',
value: project.authUsersAuthMagicURL
},
{
label: 'Anonymous',
method: 'anonymous',
value: project.authAnonymous
},
{
label: 'Invites',
method: 'invites',
value: project.authInvites
},
{
label: 'JWT',
method: 'jwt',
value: project.authJWT
}
];
set({ list });
}
};
}
export const authMethods = createAuthMethods();
@@ -1,13 +1,12 @@
import { writable } from 'svelte/store';
import type { Models } from '@aw-labs/appwrite-console';
import type { SvelteComponent } from 'svelte';
import Apple from './_appleOAuth.svelte';
import Microsoft from './_microsoftOAuth.svelte';
import Okta from './_oktaOAuth.svelte';
import Auth0 from './_auth0OAuth.svelte';
import Main from './_mainOAuth.svelte';
import Apple from '../../routes/console/[project]/users/_appleOAuth.svelte';
import Microsoft from '../../routes/console/[project]/users/_microsoftOAuth.svelte';
import Okta from '../../routes/console/[project]/users/_oktaOAuth.svelte';
import Auth0 from '../../routes/console/[project]/users/_auth0OAuth.svelte';
import Main from '../../routes/console/[project]/users/_mainOAuth.svelte';
export type AuthMethod = { label: string; method: string; value: boolean };
export type Provider = {
name: string;
icon: string;
@@ -22,72 +21,6 @@ export type Providers = {
providers: Provider[];
};
function createAuthMethods() {
const { subscribe, set } = writable({
list: [
{
label: 'Password',
method: 'email-password',
value: null
},
{
label: 'Magic URL',
method: 'magic-url',
value: null
},
{
label: 'Anonymous',
method: 'anonymous',
value: null
},
{
label: 'Invites',
method: 'invites',
value: null
},
{
label: 'JWT',
method: 'jwt',
value: null
}
]
});
return {
subscribe,
set,
load: (project: Models.Project) => {
const list = [
{
label: 'Password',
method: 'email-password',
value: project.authEmailPassword
},
{
label: 'Magic URL',
method: 'magic-url',
value: project.authUsersAuthMagicURL
},
{
label: 'Anonymous',
method: 'anonymous',
value: project.authAnonymous
},
{
label: 'Invites',
method: 'invites',
value: project.authInvites
},
{
label: 'JWT',
method: 'jwt',
value: project.authJWT
}
];
set({ list });
}
};
}
function createOAuthProviders() {
const { subscribe, set } = writable<Providers>({
providers: [
@@ -647,5 +580,4 @@ function createOAuthProviders() {
};
}
export const authMethods = createAuthMethods();
export const OAuthProviders = createOAuthProviders();
@@ -11,7 +11,7 @@
} from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdkForConsole } from '$lib/stores/sdk';
import type { Provider } from './auth';
import type { Provider } from '$lib/stores/oauth-providers';
export let showModal = false;
export let provider: Provider;
@@ -11,7 +11,7 @@
} from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdkForConsole } from '$lib/stores/sdk';
import type { Provider } from './auth';
import type { Provider } from '$lib/stores/oauth-providers';
export let showModal = false;
export let provider: Provider;
@@ -46,7 +46,7 @@
{:else}
<CardDrop bind:show={showDropdown}>
<svelte:fragment slot="header">Team ID</svelte:fragment>
<p>Enter a custom user ID. Leave blank for a randomly generated user ID.</p>
<p>Enter a custom team ID. Leave blank for a randomly generated team ID.</p>
<svelte:fragment slot="footer">
<input
class="input-text "
@@ -11,7 +11,7 @@
} from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdkForConsole } from '$lib/stores/sdk';
import type { Provider } from './auth';
import type { Provider } from '$lib/stores/oauth-providers';
export let showModal = false;
export let provider: Provider;
@@ -11,7 +11,7 @@
} from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdkForConsole } from '$lib/stores/sdk';
import type { Provider } from './auth';
import type { Provider } from '$lib/stores/oauth-providers';
export let showModal = false;
export let provider: Provider;
@@ -11,7 +11,7 @@
} from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { sdkForConsole } from '$lib/stores/sdk';
import type { Provider } from './auth';
import type { Provider } from '$lib/stores/oauth-providers';
export let showModal = false;
export let provider: Provider;
@@ -6,8 +6,9 @@
import { addNotification } from '$lib/stores/notifications';
import { sdkForConsole } from '$lib/stores/sdk';
import { project } from '../store';
import { authMethods, OAuthProviders } from './auth';
import type { Provider } from './auth';
import { authMethods } from '$lib/stores/auth-methods';
import { OAuthProviders } from '$lib/stores/oauth-providers';
import type { Provider } from '$lib/stores/oauth-providers';
$: projectId = $project.$id;
$: authMethods.load($project);