-
diff --git a/src/components/TheWelcome.vue b/src/components/TheWelcome.vue
index 6092dff..8b731d9 100644
--- a/src/components/TheWelcome.vue
+++ b/src/components/TheWelcome.vue
@@ -32,8 +32,9 @@ const openReadmeInEditor = () => fetch('/__open-in-editor?file=README.md')
recommended IDE setup is
VSCode
+
-
Vue - Official. If
- you need to test your components and web pages, check out
+
Vue - Official. If you need to test your components and web pages, check out
Vitest
and
Cypress
diff --git a/src/components/UserInfo.vue b/src/components/UserInfo.vue
index 304e1f2..5612e36 100644
--- a/src/components/UserInfo.vue
+++ b/src/components/UserInfo.vue
@@ -7,7 +7,7 @@ import { user_store } from '@/ts/user_info'
![]()
{
+ res
+ .json()
+ .then((functiontagsjson) => {
+ function_tags_store.function_tags = functiontagsjson.function_tags
+ })
+ .catch(() => {})
+ })
+ .catch(() => {})
+}
+
+export function add_function_tag(function_tag_name: string) {
+ const post_url = new URL('http://localhost:31337/post/function-tag')
+ const search_params = new URLSearchParams()
+ search_params.append('name', function_tag_name)
+ post_url.search = search_params.toString()
+ fetch(post_url, {
+ credentials: 'include',
+ method: 'POST',
+ body: JSON.stringify({
+ name: function_tag_name,
+ }),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ })
+ .then((res) => {
+ if (res.status === 400) {
+ console.log('Function Tag submitted is invalid.')
+ } else if (res.status === 401) {
+ console.log("You aren't logged in.")
+ } else {
+ update_function_tags()
+ }
+ })
+ .catch(() => {})
+}
diff --git a/src/ts/functions.ts b/src/ts/functions.ts
new file mode 100644
index 0000000..e94000a
--- /dev/null
+++ b/src/ts/functions.ts
@@ -0,0 +1,79 @@
+import { reactive, ref } from 'vue'
+
+export const functions_store = reactive({
+ functions: ref(
+ [] as Array<{
+ name: string
+ tags: {
+ id: string
+ created_at: string
+ updated_at: string
+ deleted_at: string
+ name: string
+ }[]
+ requirements: {
+ id: string
+ created_at: string
+ updated_at: string
+ deleted_at: string
+ name: string
+ }[]
+ }>,
+ ),
+})
+
+export function update_functions() {
+ fetch('http://localhost:31337/get/functions', {
+ credentials: 'include',
+ })
+ .then((res) => {
+ res
+ .json()
+ .then((functionsjson) => {
+ functions_store.functions = functionsjson.functions
+ })
+ .catch(() => {})
+ })
+ .catch(() => {})
+}
+
+export function add_function(
+ function_name: string,
+ function_tags: string[],
+ function_requirements: string[],
+) {
+ const post_url = new URL('http://localhost:31337/post/function')
+ const search_params = new URLSearchParams()
+ search_params.append('name', function_name)
+ function_tags.forEach((tag) => {
+ search_params.append('tags', tag)
+ })
+ if (function_requirements.length > 0 && function_requirements[0] != 'undefined') {
+ function_requirements.forEach((requirement) => {
+ search_params.append('requirements', requirement)
+ })
+ }
+ post_url.search = search_params.toString()
+ fetch(post_url, {
+ credentials: 'include',
+ method: 'POST',
+ body: JSON.stringify({
+ name: function_name,
+ tags: function_tags,
+ requirements: function_requirements,
+ }),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ })
+ .then((res) => {
+ if (res.status === 400) {
+ console.log('Function submitted is invalid.')
+ } else if (res.status === 401) {
+ console.log("You aren't logged in.")
+ } else {
+ update_functions()
+ }
+ })
+ .catch(() => {})
+}
diff --git a/src/ts/groups.ts b/src/ts/groups.ts
index c515df0..2ac32c2 100644
--- a/src/ts/groups.ts
+++ b/src/ts/groups.ts
@@ -1,7 +1,7 @@
-import { reactive } from 'vue'
+import { reactive, ref } from 'vue'
export const groups_store = reactive({
- groups: [],
+ groups: ref([]),
})
export function update_groups() {
diff --git a/src/views/UserDashboard.vue b/src/views/UserDashboard.vue
index 38148ad..5294ba3 100644
--- a/src/views/UserDashboard.vue
+++ b/src/views/UserDashboard.vue
@@ -1,13 +1,21 @@
@@ -19,20 +27,65 @@ onMounted(update_groups)
-
> USER AUTHENTICATED
+ > USER AUTHENTICATED
-