feat: working unraid-api gql

This commit is contained in:
Zack Spear
2023-07-19 13:09:01 -07:00
committed by Zack Spear
parent 68fd5b83f2
commit f2d1738f7b
13 changed files with 6321 additions and 528 deletions

View File

@@ -0,0 +1,15 @@
import { graphql } from "~/composables/gql/gql";
export const TEST_FRAGMENT = graphql(/* GraphQL */`
fragment TestFragment on Cloud {
error
}
`);
export const TEST_QUERY = graphql(/* GraphQL */`
query cloudError {
cloud {
...TestFragment
}
}
`);

View File

@@ -1,8 +1,21 @@
<script setup lang="ts">
import { ExclamationTriangleIcon, CheckCircleIcon } from '@heroicons/vue/24/solid';
// import { storeToRefs } from 'pinia';
// import { useServerStore } from '~/store/server';
// const { stateData } = storeToRefs(useServerStore());
import { useQuery } from '@vue/apollo-composable';
import {
TEST_FRAGMENT,
TEST_QUERY,
} from './DropdownConnectStatus.fragment';
import { useFragment } from '@/composables/gql/fragment-masking';
const { result: newResult } = useQuery(
TEST_QUERY,
);
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');