Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: state dependencies #107

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 30 additions & 29 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
export const PAGE_LIMIT = 12; // default page limit
export const CARD_LIMIT = 6; // default card limit
export enum Dependencies {
PROJECT = 'project',
PROJECTS = 'projects',
ACCOUNT = 'account',
ACCOUNT_SESSIONS = 'account_sessions',
USER = 'user',
USERS = 'users',
SESSIONS = 'sessions',
TEAM = 'team',
TEAMS = 'teams',
MEMBERSHIPS = 'memberships',
DATABASE = 'database',
COLLECTION = 'collection',
DOCUMENT = 'document',
DOCUMENTS = 'documents',
BUCKET = 'bucket',
FILE = 'file',
FILES = 'files',
FUNCTION = 'function',
FUNCTIONS = 'functions',
VARIABLES = 'variables',
DEPLOYMENTS = 'deployments',
EXECUTIONS = 'executions',
PLATFORM = 'platform',
PLATFORMS = 'platforms',
KEY = 'key',
KEYS = 'keys',
DOMAINS = 'domains',
WEBHOOK = 'webhook',
WEBHOOKS = 'webhooks'
ORGANIZATION = 'dependency:organization',
PROJECT = 'dependency:project',
PROJECTS = 'dependency:projects',
ACCOUNT = 'dependency:account',
ACCOUNT_SESSIONS = 'dependency:account_sessions',
USER = 'dependency:user',
USERS = 'dependency:users',
SESSIONS = 'dependency:sessions',
TEAM = 'dependency:team',
TEAMS = 'dependency:teams',
MEMBERSHIPS = 'dependency:memberships',
DATABASE = 'dependency:database',
COLLECTION = 'dependency:collection',
DOCUMENT = 'dependency:document',
DOCUMENTS = 'dependency:documents',
BUCKET = 'dependency:bucket',
FILE = 'dependency:file',
FILES = 'dependency:files',
FUNCTION = 'dependency:function',
FUNCTIONS = 'dependency:functions',
VARIABLES = 'dependency:variables',
DEPLOYMENTS = 'dependency:deployments',
EXECUTIONS = 'dependency:executions',
PLATFORM = 'dependency:platform',
PLATFORMS = 'dependency:platforms',
KEY = 'dependency:key',
KEYS = 'dependency:keys',
DOMAINS = 'dependency:domains',
WEBHOOK = 'dependency:webhook',
WEBHOOKS = 'dependency:webhooks'
}

export const scopes = [
Expand Down
4 changes: 3 additions & 1 deletion src/routes/console/organization-[organization]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import Breadcrumbs from './breadcrumbs.svelte';
import { sdkForConsole } from '$lib/stores/sdk';
import type { LayoutLoad } from './$types';
import { error } from '@sveltejs/kit';
import { Dependencies } from '$lib/constants';

export const load: LayoutLoad = async ({ params, parent }) => {
export const load: LayoutLoad = async ({ params, parent, depends }) => {
await parent();
depends(Dependencies.ORGANIZATION);

try {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
async function updateName() {
try {
await sdkForConsole.teams.update($organization.$id, name);
await invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.ORGANIZATION);
addNotification({
message: 'Name has been updated',
type: 'success'
Expand Down