Прокинут запрос с клиента на сервер для проверки связи с API

This commit is contained in:
Alex committed 2024-01-12 11:26:26 +03:00
1 parent 2e0a85c93c
commit bae4547681
4 files changed
+31 -8

No files matched your search

@@ -148,10 +148,10 @@
:title="x.name" :title="x.name"
:value="x.name" :value="x.name"
:href="x.link" :href="x.link"
:disabled="x.path=='/securyty'" :disabled="x.path==''"
:to="x.path" :to="x.path"
color="navigation"> color="navigation">
<!-- Чтобы сделать неактивным раздел безопасность, не забыть прописать путь до него в disabled для показа -->
<template v-slot:prepend> <template v-slot:prepend>
<v-icon :icon="x.ico"/> <v-icon :icon="x.ico"/>
<v-tooltip <v-tooltip
+2 -2
View File
@@ -61,7 +61,7 @@ const routes = [
name: 'LaborProtection', name: 'LaborProtection',
component: () => import('@/views/LaborProtection.vue'), component: () => import('@/views/LaborProtection.vue'),
meta:{ meta:{
title:"Безопасность", title:"Охрана труда",
ico: "mdi-pharmacy" ico: "mdi-pharmacy"
} }
}, },
@@ -70,7 +70,7 @@ const routes = [
name: 'SecurityPage', name: 'SecurityPage',
component: () => import('@/views/SecurityPage.vue'), component: () => import('@/views/SecurityPage.vue'),
meta:{ meta:{
title:"Охрана труда", title:"Безопасность",
ico: "mdi-ticket" ico: "mdi-ticket"
} }
}, },
+26 -2
View File
@@ -1,19 +1,43 @@
<template> <template>
<v-row> <v-row class="bg-red w-100">
<v-col <v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light" class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
> >
Безопасность <!-- Безопасность -->
</v-col> </v-col>
</v-row> </v-row>
<v-container class="bg-green">
{{ safetyData }}
</v-container>
</template> </template>
<script> <script>
import { ref } from 'vue';
import {pagecounter} from '@/utils/universal_functions' import {pagecounter} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api';
export default { export default {
setup() { setup() {
pagecounter() pagecounter()
const safetyData = ref([])
const safety = () => {
axiosApiInstance.get(`api/safety/files/`).then(result => {
safetyData.value = result.data
})
}
// console.log('Должно прийти с сервера хоть что-то' ,safetyData)
return {
safetyData,
safety
}
} }
} }
</script> </script>
+1 -2
View File
@@ -10,6 +10,5 @@ class SafetyFileAPIView(APIView):
all_file = SafetyFile.objects.all() all_file = SafetyFile.objects.all()
serializer_for_file = SafetyFileSerializer(instance=all_file, many=True) serializer_for_file = SafetyFileSerializer(instance=all_file, many=True)
# print(serializer_for_file)
return Response({'Файлы': serializer_for_file}) return Response({'safety_files': serializer_for_file.data})