refactor: apollo client creation + WIP subscriptions

This commit is contained in:
Zack Spear
2023-07-19 18:15:34 -07:00
committed by Zack Spear
parent dd3ae0ed3d
commit fb05a5e26d
12 changed files with 422 additions and 95 deletions
+2 -6
View File
@@ -66,12 +66,8 @@ onBeforeMount(() => {
if (typeof props.server === 'object') { // Handles the testing dev Vue component
serverStore.setServer(props.server);
} else if (typeof props.server === 'string') { // Handle web component
try {
const parsedServerProp = JSON.parse(props.server);
serverStore.setServer(parsedServerProp);
} catch (e) {
console.error(e);
}
const parsedServerProp = JSON.parse(props.server);
serverStore.setServer(parsedServerProp);
}
/**
* Listen for callbacks, if we receive one that needs to be acted upon the store will display
@@ -1,5 +1,10 @@
<script setup lang="ts">
import { ExclamationTriangleIcon, CheckCircleIcon } from '@heroicons/vue/24/solid';
type ApiOnlineStatus = 'online'|'offline';
const onlineStatus = ref<ApiOnlineStatus>('online');
const apiLoading = ref(false);
import { useQuery } from '@vue/apollo-composable';
import {
@@ -16,10 +21,6 @@ const result = computed(() => useFragment(TEST_FRAGMENT, newResult.value?.cloud)
watch(result, (newVal, oldVal) => {
console.log('result', newVal, oldVal);
});
type ApiOnlineStatus = 'online'|'offline';
const onlineStatus = ref<ApiOnlineStatus>('online');
const apiLoading = ref(false);
</script>
<template>
+2 -1
View File
@@ -1,3 +1,4 @@
<script setup lang="ts">
import { ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/solid';
import type { ServerStateDataAction } from '~/types/server';
@@ -5,7 +6,7 @@ import type { UserProfileLink } from '~/types/userProfile';
export interface Props {
item: ServerStateDataAction | UserProfileLink;
rounded: boolean;
rounded?: boolean;
}
const props = withDefaults(defineProps<Props>(), {