Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: added function instructions and function details page

Jonathan Summers-Muir8e0d8acc7b64
diff --git a/studio/pages/project/[ref]/functions/[id]/details.tsx b/studio/pages/project/[ref]/functions/[id]/details.tsx
index 172498db3af..92a3b3a2c36 100644
--- a/studio/pages/project/[ref]/functions/[id]/details.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/details.tsx
@@ -1,10 +1,200 @@
import { observer } from 'mobx-react-lite'
-import { withAuth } from 'hooks'
+import { useStore, withAuth } from 'hooks'
import FunctionLayout from './../interfaces/FunctionLayout'
+import CommandRender from '../interfaces/CommandRender'
+import { useRouter } from 'next/router'
+import { useEffect, useState } from 'react'
+import { toJS } from 'mobx'
+import { IconExternalLink, IconGlobe, IconTerminal, Loading } from '@supabase/ui'
+import Link from 'next/link'
+import dayjs from 'dayjs'
const PageLayout = () => {
- return <FunctionLayout>Details</FunctionLayout>
+ const router = useRouter()
+ const { ref, id } = router.query
+
+ const { functions, ui } = useStore()
+
+ const [selectedFunction, setSelectedFunction] = useState<any>(null)
+
+ useEffect(() => {
+ setSelectedFunction(functions.byId(id))
+ }, [functions.isLoaded, ui.selectedProject])
+
+ // if (!functions.isLoading) return <></>
+
+ console.log('selected', functions.byId(id))
+
+ const managementCommands: any = [
+ {
+ command: `supabase functions deploy ${selectedFunction?.name}`,
+ description: 'This will overwrite the deployed function with your new function',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> functions deploy{' '}
+ {selectedFunction?.name}
+ </>
+ )
+ },
+ comment: 'Deploy a new version',
+ },
+ {
+ command: `supabase functions deploy ${selectedFunction?.name}`,
+ description: 'This will remove the function and all the logs associated with it',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> functions delete{' '}
+ {selectedFunction?.name}
+ </>
+ )
+ },
+ comment: 'Delete the function',
+ },
+ ]
+
+ const secretCommands: any = [
+ {
+ command: `supabase secrets list`,
+ description: 'This will list all the secrets for your project',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> secrets list
+ </>
+ )
+ },
+ comment: 'View all secrets',
+ },
+ {
+ command: `supabase secrets set NAME1=VALUE NAME2=VALUE`,
+ description: 'This will set secrets for your project',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> secrets set NAME=VALUE NAME=VALUE
+ </>
+ )
+ },
+ comment: 'Set secrets for your project',
+ },
+ {
+ command: `supabase secrets unset NAME1 NAME2 `,
+ description: 'This will deleet secrets for your project',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> secrets unset NAME1 NAME2
+ </>
+ )
+ },
+ comment: 'Set secrets for your project',
+ },
+ ]
+
+ return (
+ <FunctionLayout>
+ <div className="grid grid-cols-2 lg:gap-x-16 py-12">
+ <div>
+ <div className="px-12 py-8 bg-scale-100 dark:bg-scale-300 rounded border">
+ {console.log('inside the render', functions.byId(id))}
+ <div>{selectedFunction?.createdAt}</div>
+
+ <div className="space-y-4">
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Function name</span>
+ <div className="text-base text-scale-1100">{selectedFunction?.name}</div>
+ </div>
+
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Status</span>
+ <div className="flex items-center gap-2">
+ <div
+ className="text-base bg-brand-300 dark:bg-brand-100 px-3 py-0.5 rounded-full lowercasefirst-letter:
+ flex items-center gap-3 lowercase text-brand-900
+ "
+ >
+ {selectedFunction?.status}
+ <div className="relative w-2 h-2">
+ <span className="flex h-2 w-2">
+ <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-800 opacity-75"></span>
+ <span className="relative inline-flex rounded-full h-2 w-2 bg-brand-900"></span>
+ </span>
+ </div>
+ </div>
+ <span className="text-xs text-scale-900">This function is running correctly</span>
+ </div>
+ </div>
+
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Endpoint url</span>
+ <Link
+ href={`https://${ref}.functions.supabase.co/${selectedFunction?.name}`}
+ passHref
+ >
+ <a
+ className="flex items-center gap-2 group text-scale-1100 hover:text-scale-1200"
+ target="_target"
+ >
+ <span className="underline">{`https://${ref}.functions.supabase.co/${selectedFunction?.name}`}</span>
+ <IconExternalLink size={14} />
+ </a>
+ </Link>
+ </div>
+
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Created at</span>
+ <div className="text-base text-scale-1100">
+ {selectedFunction?.created_at &&
+ dayjs(selectedFunction.created_at).format('dddd, MMMM D, YYYY h:mm A')}
+ </div>
+ </div>
+
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Updated at</span>
+ <div className="text-base text-scale-1100">
+ {selectedFunction?.updated_at &&
+ dayjs(selectedFunction.updated_at).format('dddd, MMMM D, YYYY h:mm A')}
+ </div>
+ </div>
+
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Version</span>
+ <div className="text-base text-scale-1100">v {selectedFunction?.version}</div>
+ </div>
+
+ <div>
+ <span className="block text-scale-900 text-xs mb-1">Regions</span>
+ <div className="flex items-center gap-3">
+ <div className="text-base text-scale-1100 flex items-center gap-2">
+ <IconGlobe />
+ <span>Earth</span>
+ </div>
+ <span className="text-xs text-scale-900">Supabase functions run on the edge</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div>
+ <div className="px-12 py-8 bg-scale-100 dark:bg-scale-300 rounded border space-y-6">
+ <div className="flex items-center gap-3">
+ <div className="border p-2 flex items-center justify-center w-8 h-8 text-scale-100 dark:text-scale-1200 bg-scale-1200 dark:bg-scale-100 rounded">
+ <IconTerminal strokeWidth={2} />
+ </div>
+ <h4>Command line access</h4>
+ </div>
+ <h5 className="text-sm text-base">Deployment management</h5>
+ <CommandRender commands={managementCommands} />
+ <h5 className="text-sm text-base">Secrets management</h5>
+ <CommandRender commands={secretCommands} />
+ </div>
+ </div>
+ </div>
+ </FunctionLayout>
+ )
}
export default withAuth(observer(PageLayout))
diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsx
index cbcc605d869..368356d851c 100644
--- a/studio/pages/project/[ref]/functions/index.tsx
+++ b/studio/pages/project/[ref]/functions/index.tsx
@@ -4,7 +4,10 @@ import { useStore, withAuth } from 'hooks'
import FunctionsLayout from './interfaces/FunctionsLayout'
import {
Button,
+ IconBookOpen,
IconChevronRight,
+ IconClipboard,
+ IconCopy,
IconExternalLink,
IconGlobe,
IconSearch,
@@ -22,6 +25,10 @@ import { post } from 'lib/common/fetch'
import { API_URL, PROJECT_STATUS } from 'lib/constants'
import { useProjectFunctionsStore } from 'stores/projectFunctionsStore'
import { toJS } from 'mobx'
+import CommandRender from './interfaces/CommandRender'
+import Link from 'next/link'
+
+import { Function } from './interfaces/Functions.types'
const EmptyFunctions = () => {
const router = useRouter()
@@ -30,33 +37,75 @@ const EmptyFunctions = () => {
interface Commands {
command: string
description: string
+ jsx?: () => void
+ comment?: string
}
const commands: Commands[] = [
{
- command: 'supabase init',
+ command: 'Run supabase ',
description: "Needed if the project hasen't been inited before",
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> init
+ </>
+ )
+ },
+ comment: 'Initialize Supabase locally',
},
{
- command: 'supabase login',
+ command: 'Login to supabase',
description: "Writes the user's API token to disk",
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> login
+ </>
+ )
+ },
+ comment: 'Login using your access token',
},
{
command: `sudo supabase link --ref ${ref}`,
description: `Sets the Supabase project to be associated with your project ${ref}`,
+ jsx: () => {
+ return (
+ <>
+ sudo <span className="text-brand-1100">supabase</span> link --ref {ref}
+ </>
+ )
+ },
+ comment: 'Link this project',
},
{
command: 'supabase functions new hello',
description: ' creates a function stub at ./functions/hello.ts',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> functions new hello
+ </>
+ )
+ },
+ comment: 'Create a function',
},
{
command: 'supabase functions deploy hello',
description: 'Deploys function at ./functions/hello.ts',
+ jsx: () => {
+ return (
+ <>
+ <span className="text-brand-1100">supabase</span> functions deploy hello
+ </>
+ )
+ },
+ comment: 'Deploy your function',
},
]
return (
<>
- <div className="grid grid-cols-2 gap-8 max-w-7xl">
- <div className="space-y-4">
+ <div className="grid lg:grid-cols-12 gap-y-12 lg:gap-x-16 max-w-7xl py-12">
+ <div className="space-y-4 col-span-5">
<p className="text-scale-1200 text-base max-w-lg">
Scalable pay-as-you-go functions as a service (FaaS) to run your code with zero server
management.
@@ -68,17 +117,19 @@ const EmptyFunctions = () => {
for hybrid and multi-cloud scenarios
</p>
<div className="flex gap-2">
- <Button iconRight={<IconChevronRight />}>Get started</Button>
- <Button type="link" iconRight={<IconExternalLink />}>
- Documentation
- </Button>
+ <Link passHref href="https://supabase.com/docs/functions">
+ <Button as="a" type="default" iconRight={<IconBookOpen />}>
+ Documentation
+ </Button>
+ </Link>
</div>
</div>
<div
className="
- bg-scale-100 dark:bg-scale-300 px-5 py-4
+ col-span-7
+ bg-scale-100 dark:bg-scale-300 px-8 py-6
shadow
- max-w-lg
+
border rounded
space-y-8"
>
@@ -89,33 +140,56 @@ const EmptyFunctions = () => {
<h4>Terminal instructions</h4>
</div>
<div className="space-y-4">
- {commands.map((item: Commands) => {
- return (
- <>
- <Input
- size="small"
- readOnly
- value={item.command}
- copy
- icon={'$'}
- descriptionText={item.description}
- />
- {/* <p className="text-sm text-scale-900">{item.description}</p> */}
- </>
- )
- })}
+ <CommandRender commands={commands} />
</div>
</div>
- <div
- className="
+ </div>
+ </>
+ )
+}
+
+const FunctionsList = ({ functions }: { functions: Function[] }) => {
+ return (
+ <>
+ <div className="flex flex-col gap-3">
+ <div className="flex justify-between items-center">
+ <span className="text-sm text-scale-900">{`${functions.length} function${
+ functions.length > 1 ? 's' : ''
+ } deployed`}</span>
+ <Input icon={<IconSearch size={14} />} size="tiny" />
+ </div>
+ <div>
+ <Table
+ head={
+ <>
+ <Table.th>Name</Table.th>
+ <Table.th>Trigger</Table.th>
+ <Table.th>Status</Table.th>
+ <Table.th className="hidden 2xl:table-cell">Created</Table.th>
+ <Table.th className="hidden 2xl:table-cell">Last updated</Table.th>
+ <Table.th className="hidden 2xl:table-cell">Version</Table.th>
+ </>
+ }
+ body={
+ <>
+ {functions.length > 0 &&
+ functions.map((item: any) => <FunctionsListItem key={item.id} function={item} />)}
+ </>
+ }
+ />
+ </div>
+ </div>
+
+ <div
+ className="
col-span-2
bg-scale-300 rounded px-10 py-8 flex flex-col gap-8"
- >
- <h2 className="text-sm text-scale-1100">Function examples</h2>
- <div className="grid lg:grid-cols-3 gap-8">
- <div className="flex flex-col gap-3">
- <div
- className="
+ >
+ <h2 className="text-sm text-scale-1100">Function examples</h2>
+ <div className="grid lg:grid-cols-3 gap-8">
+ <div className="flex flex-col gap-3">
+ <div
+ className="
h-10 w-10
bg-indigo-900
bordershadow-indigo-900
@@ -123,19 +197,19 @@ const EmptyFunctions = () => {
text-scale-fixed-100
flex items-center justify-center
"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
+ >
+ <IconGlobe />
+ </div>
+ <div className="">
+ <h3 className="text-scale-1200">Stripe payments</h3>
+ <p className="text-scale-1100">
+ Charge a payment credit card when a database event occurs
+ </p>
</div>
- <div className="flex flex-col gap-3">
- <div
- className="
+ </div>
+ <div className="flex flex-col gap-3">
+ <div
+ className="
h-10 w-10
bg-indigo-900
bordershadow-indigo-900
@@ -143,19 +217,19 @@ const EmptyFunctions = () => {
text-scale-fixed-100
flex items-center justify-center
"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
+ >
+ <IconGlobe />
+ </div>
+ <div className="">
+ <h3 className="text-scale-1200">Stripe payments</h3>
+ <p className="text-scale-1100">
+ Charge a payment credit card when a database event occurs
+ </p>
</div>
- <div className="flex flex-col gap-3">
- <div
- className="
+ </div>
+ <div className="flex flex-col gap-3">
+ <div
+ className="
h-10 w-10
bg-indigo-900
bordershadow-indigo-900
@@ -163,15 +237,14 @@ const EmptyFunctions = () => {
text-scale-fixed-100
flex items-center justify-center
"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
+ >
+ <IconGlobe />
+ </div>
+ <div className="">
+ <h3 className="text-scale-1200">Stripe payments</h3>
+ <p className="text-scale-1100">
+ Charge a payment credit card when a database event occurs
+ </p>
</div>
</div>
</div>
@@ -180,75 +253,6 @@ const EmptyFunctions = () => {
)
}
-interface Function {
- id: string
- slug: string
- name: string
- version: 9
- status: 'ACTIVE' | 'INACTIVE' | 'THROTTLE'
- created_at: number
- updated_at: number
-}
-
-const FunctionsList = ({ functions }: { functions: Function[] }) => {
- // const PageState = {
- // functions: [
- // {
- // name: 'hello-world',
- // id: 1,
- // runtime: 'Node14',
- // memory: 256,
- // created_at: 1646524256,
- // },
- // {
- // name: 'charge',
- // id: 2,
- // runtime: 'Node14',
- // memory: 256,
- // created_at: 1646524256,
- // },
- // {
- // name: 'projects',
- // id: 3,
- // runtime: 'Node14',
- // memory: 512,
- // created_at: 1646524256,
- // },
- // ],
- // }
-
- return (
- <div className="flex flex-col gap-3">
- <div className="flex justify-between items-center">
- <span className="text-sm text-scale-900">{`${functions.length} function${
- functions.length > 1 ? 's' : ''
- } deployed`}</span>
- <Input icon={<IconSearch size={14} />} size="tiny" />
- </div>
- <div>
- <Table
- head={
- <>
- <Table.th>Name</Table.th>
- <Table.th>Trigger</Table.th>
- <Table.th>Status</Table.th>
- <Table.th className="hidden 2xl:table-cell">Created</Table.th>
- <Table.th className="hidden 2xl:table-cell">Last updated</Table.th>
- <Table.th className="hidden 2xl:table-cell">Version</Table.th>
- </>
- }
- body={
- <>
- {functions.length > 0 &&
- functions.map((item: any) => <FunctionsListItem key={item.id} function={item} />)}
- </>
- }
- />
- </div>
- </div>
- )
-}
-
const PageLayout = () => {
const router = useRouter()
const { ui, functions } = useStore()
@@ -282,10 +286,10 @@ const PageLayout = () => {
)
if (functions.list().length <= 0) {
+ // if (true) {
return (
- <FunctionsLayout>
+ <FunctionsLayout centered={true}>
<EmptyFunctions />
- <Selection />
</FunctionsLayout>
)
} else {
diff --git a/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx b/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx
new file mode 100644
index 00000000000..17893794187
--- /dev/null
+++ b/studio/pages/project/[ref]/functions/interfaces/CommandRender.tsx
@@ -0,0 +1,49 @@
+import { IconCheck, IconClipboard } from '@supabase/ui'
+import { useState } from 'react'
+
+const CommandRender = ({ commands }: any) => {
+ console.log('commands', commands)
+ return (
+ <div className="space-y-4">
+ {commands.map((item: any) => {
+ const [isCopied, setIsCopied] = useState(false)
+ return (
+ <div>
+ <span className="font-mono text-xs text-scale-900">{`> ${item.comment}`}</span>
+ <div className="flex items-center gap-2">
+ <div className="flex items-center gap-2 text-scale-1200 font-mono text-sm font-normal">
+ <span className="text-scale-900">$</span>
+ {item.jsx ? item.jsx() : null}
+ </div>
+ <button
+ type="button"
+ className="text-scale-900 hover:text-scale-1200"
+ onClick={() => {
+ function onCopy(value: any) {
+ setIsCopied(true)
+ navigator.clipboard.writeText(value).then()
+ setTimeout(function () {
+ setIsCopied(false)
+ }, 3000)
+ }
+ onCopy(item.command)
+ }}
+ >
+ {isCopied ? (
+ <div className="text-brand-900">
+ <IconCheck size={14} strokeWidth={3} />
+ </div>
+ ) : (
+ <IconClipboard size={14} />
+ )}
+ </button>
+ </div>
+ <span className="text-xs text-scale-900">{item.description}</span>
+ </div>
+ )
+ })}
+ </div>
+ )
+}
+
+export default CommandRender
diff --git a/studio/pages/project/[ref]/functions/interfaces/FunctionLayout.tsx b/studio/pages/project/[ref]/functions/interfaces/FunctionLayout.tsx
index abf598adba9..40673834c81 100644
--- a/studio/pages/project/[ref]/functions/interfaces/FunctionLayout.tsx
+++ b/studio/pages/project/[ref]/functions/interfaces/FunctionLayout.tsx
@@ -6,18 +6,19 @@ import { Tab } from '@headlessui/react'
import FunctionsNav from './FunctionsNav'
import React, { useEffect } from 'react'
import { useRouter } from 'next/router'
+import Link from 'next/link'
const PageLayout = ({ children }: { children?: React.ReactNode }) => {
const { functions, ui } = useStore()
const router = useRouter()
- const { id } = router.query
+ const { id, ref } = router.query
useEffect(() => {
functions.load()
}, [ui.selectedProject])
- if (!functions.isInitialized) {
+ if (!functions.list()) {
return (
<BaseLayout>
<Loading active={true}>loading</Loading>
@@ -25,12 +26,13 @@ const PageLayout = ({ children }: { children?: React.ReactNode }) => {
)
}
+ console.log('has functions')
+
const item = functions.byId(id)
+ console.log(item)
const name = item?.name || ''
- console.log('item', item)
-
return (
<BaseLayout>
<div className="h-full flex flex-col flex-grow py-10">
@@ -58,7 +60,17 @@ const PageLayout = ({ children }: { children?: React.ReactNode }) => {
>
<IconCode size={14} strokeWidth={3} />
</div>
- <h1 className="text-2xl text-scale-1200">Functions</h1>
+ <Link href={`/project/${ref}/functions`}>
+ <h1
+ className="
+ transition-colors
+ text-2xl text-scale-1200
+ cursor-pointer
+ hover:text-scale-1100"
+ >
+ Functions
+ </h1>
+ </Link>
<span className="text-scale-800 dark:text-scale-700">
<svg
diff --git a/studio/pages/project/[ref]/functions/interfaces/Functions.types.ts b/studio/pages/project/[ref]/functions/interfaces/Functions.types.ts
new file mode 100644
index 00000000000..ed54073082f
--- /dev/null
+++ b/studio/pages/project/[ref]/functions/interfaces/Functions.types.ts
@@ -0,0 +1,9 @@
+export interface Function {
+ id: string
+ slug: string
+ name: string
+ version: 9
+ status: 'ACTIVE' | 'INACTIVE' | 'THROTTLE'
+ created_at: number
+ updated_at: number
+}
diff --git a/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx b/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx
index 363157631da..0bf6ba5a3a9 100644
--- a/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx
+++ b/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx
@@ -7,7 +7,7 @@ import FunctionsNav from '../interfaces/FunctionsNav'
import React, { useEffect } from 'react'
import { useRouter } from 'next/router'
-const PageLayout = ({ children }: { children?: React.ReactNode }) => {
+const PageLayout = ({ children, centered }: { children?: React.ReactNode; centered?: boolean }) => {
const { functions, ui } = useStore()
const router = useRouter()
@@ -27,8 +27,26 @@ const PageLayout = ({ children }: { children?: React.ReactNode }) => {
return (
<BaseLayout>
- <div
- className="
+ {centered ? (
+ <>
+ <div className="mx-auto max-w-5xl py-32 px-5">
+ <div className="flex items-center gap-3">
+ <div
+ className="w-6 h-6 bg-brand-300 border border-brand-600 rounded text-brand-900
+ flex items-center justify-center
+ "
+ >
+ <IconCode size={14} strokeWidth={3} />
+ </div>
+ <h1 className="text-2xl text-scale-1200">Functions</h1>
+ </div>
+
+ {children}
+ </div>
+ </>
+ ) : (
+ <div
+ className="
py-10
w-full mx-auto
@@ -43,20 +61,21 @@ const PageLayout = ({ children }: { children?: React.ReactNode }) => {
flex flex-col
gap-8
"
- >
- <div className="flex items-center gap-3">
- <div
- className="w-6 h-6 bg-brand-300 border border-brand-600 rounded text-brand-900
+ >
+ <div className="flex items-center gap-3">
+ <div
+ className="w-6 h-6 bg-brand-300 border border-brand-600 rounded text-brand-900
flex items-center justify-center
"
- >
- <IconCode size={14} strokeWidth={3} />
+ >
+ <IconCode size={14} strokeWidth={3} />
+ </div>
+ <h1 className="text-2xl text-scale-1200">Functions</h1>
</div>
- <h1 className="text-2xl text-scale-1200">Functions</h1>
- </div>
- {children}
- </div>
+ {children}
+ </div>
+ )}
</BaseLayout>
)
}
diff --git a/studio/stores/functions/ProjectFunctionsStore.ts b/studio/stores/functions/ProjectFunctionsStore.ts
index c23725c5dba..fd55944af93 100644
--- a/studio/stores/functions/ProjectFunctionsStore.ts
+++ b/studio/stores/functions/ProjectFunctionsStore.ts
@@ -11,6 +11,7 @@ import { IRootStore } from '../RootStore'
export interface IProjectFunctionsStore {
isLoading: boolean
isInitialized: boolean
+ isLoaded: boolean
error: any
load: () => void
@@ -51,6 +52,10 @@ export default class ProjectFunctionsStore implements IProjectFunctionsStore {
return this.state !== this.STATES.INITIAL
}
+ get isLoaded() {
+ return this.state !== this.STATES.LOADED
+ }
+
async fetchData() {
const headers = {
'Content-Type': 'application/json',