diff --git a/src/components/profile/PublicProfileInfo.vue b/src/components/profile/PublicProfileInfo.vue
index 49f3a82..7c5bec9 100644
--- a/src/components/profile/PublicProfileInfo.vue
+++ b/src/components/profile/PublicProfileInfo.vue
@@ -6,13 +6,16 @@ import {commonProps} from "src/composables/inputs";
import RichTextEditor from "components/inputs/RichTextEditor.vue";
import FormWrapper from "components/FormWrapper.vue";
import {setDefaultData} from "src/composables/form/formHandling";
+import {isRequestPending} from "src/composables/form/props";
const props = defineProps({
user: {
type: Object,
required: false,
default: null
- }
+ },
+ isRequestPending,
+
})
const formData = reactive({
@@ -26,7 +29,7 @@ watch(() => props.user, (newVal) => {
-
+
diff --git a/src/graphql/mutations/flight.js b/src/graphql/mutations/flight.js
index 5b3bf5b..59808c9 100644
--- a/src/graphql/mutations/flight.js
+++ b/src/graphql/mutations/flight.js
@@ -4,13 +4,11 @@ import {FRAGMENT_FLIGHT_FULL_INFO} from "src/graphql/fragments/flight";
export const CREATE_FLIGHT = gql`
mutation createFlight($input: CreateFlightInput!) {
createFlight(input: $input) {
- ...flightFullInfo
+ id
}
}
-
- ${FRAGMENT_FLIGHT_FULL_INFO}
`
-
+// ^^ nesmim se tu ptat na aircraft, jinak mi to upadne
export const EDIT_FLIGHT = gql`
mutation editFlight($id: Int!, $input: EditFlightInput!) {
editFlight(id: $id, input: $input) {
diff --git a/src/layouts/ProfileLayout.vue b/src/layouts/ProfileLayout.vue
index 9d5a044..672ed49 100644
--- a/src/layouts/ProfileLayout.vue
+++ b/src/layouts/ProfileLayout.vue
@@ -20,13 +20,21 @@
-
+
+
+
+
Osobní nastavení
-
- Odhlásit
+
+
+
+
+
+ Odhlásit
+
diff --git a/src/pages/profile/ProfilePage.vue b/src/pages/profile/ProfilePage.vue
index 03b448e..a2c6a79 100644
--- a/src/pages/profile/ProfilePage.vue
+++ b/src/pages/profile/ProfilePage.vue
@@ -13,11 +13,11 @@ useAppStore().setPageTitle("Profil");
const loggedUser = storeToRefs(useUserStore()).user;
const $q = useQuasar();
-const handleSave = (formData) => {
- useUserStore().update(loggedUser.id, formData).then((user) => {
- $q.notify(successObject("Uspesne upraveno"));
- });
+const handleSave = async (formData) => {
+ await useUserStore().update(formData);
+ $q.notify(successObject("Úspěšně uloženo"));
};
+const isRequestPending = storeToRefs(useUserStore()).isMutationRunning;
const openedTab = ref("profile");
@@ -30,15 +30,15 @@ const openedTab = ref("profile");
-
+
-
+
-
+
diff --git a/src/pages/profile/aircraft/AircraftDetailPage.vue b/src/pages/profile/aircraft/AircraftDetailPage.vue
index 547850c..630cd6c 100644
--- a/src/pages/profile/aircraft/AircraftDetailPage.vue
+++ b/src/pages/profile/aircraft/AircraftDetailPage.vue
@@ -10,6 +10,7 @@ import FAB from "components/FAB.vue";
import {useAppStore} from "stores/App";
import FlightsList from "components/flights/FlightsList.vue";
import {copilot} from "src/composables/objects/copilot";
+import {flight} from "src/composables/objects/flight";
const aircraftId = parseInt(useRoute().params.id);
onMounted(() => {
@@ -44,6 +45,21 @@ watch(aircraft, (newVal) => {
+
+
+
+
+
+
+
+
+
@@ -55,9 +71,10 @@ watch(aircraft, (newVal) => {
-
-
-
+
+
+
+
@@ -68,7 +85,7 @@ watch(aircraft, (newVal) => {
-
+
diff --git a/src/pages/profile/flight/EditFlightPage.vue b/src/pages/profile/flight/EditFlightPage.vue
index 435f2b9..1a2be55 100644
--- a/src/pages/profile/flight/EditFlightPage.vue
+++ b/src/pages/profile/flight/EditFlightPage.vue
@@ -55,6 +55,8 @@ const handleFlightEdit = (data) => {
})
}
+const isRequestPending = storeToRefs(useFlightsStore()).isMutationRunning;
+
const handlePhotosUpload = (data) => {
const promises = [];
for (const photo of data.photos) {
@@ -134,6 +136,7 @@ const openPhotoEdit = (photo) => {
@@ -144,6 +147,8 @@ const openPhotoEdit = (photo) => {
@save="handlePhotoUpdate"
/>
+ Tu nejsou videt fotky po nahrani
+
{
})
const poiTypes = storeToRefs(usePointsOfInterestTypeStore()).items;
+const loggedUser = storeToRefs(useUserStore()).user;
const $q = useQuasar();
const router = useRouter();
@@ -40,6 +43,6 @@ const handleSave = (data) => {
-
+
diff --git a/src/pages/profile/poi/PointOfInterestDetailPage.vue b/src/pages/profile/poi/PointOfInterestDetailPage.vue
index 2e1cb71..1325968 100644
--- a/src/pages/profile/poi/PointOfInterestDetailPage.vue
+++ b/src/pages/profile/poi/PointOfInterestDetailPage.vue
@@ -29,7 +29,7 @@ onMounted(() => {
-
+
{
Pokud přidáš toto místo k nějaké fotce, zobrazí se tu.
-
+
diff --git a/src/stores/Aircrafts.js b/src/stores/Aircrafts.js
index 9899ef6..803c4e9 100644
--- a/src/stores/Aircrafts.js
+++ b/src/stores/Aircrafts.js
@@ -6,7 +6,8 @@ import {deleteFromItems, updateInItems} from "stores/helpers";
export const useAircraftsStore = defineStore('Aircrafts', {
state: () => ({
- items: []
+ items: [],
+ isMutationRunning: false
}),
getters: {
@@ -15,18 +16,19 @@ export const useAircraftsStore = defineStore('Aircrafts', {
actions: {
fetchDetail(id) {
- console.log(id);
return apolloWrapper
.query(AIRCRAFT_DETAIL, {id})
.then((result) => result.data.aircraft);
},
create(formData) {
delete formData['id'];
+
+ this.isMutationRunning = true;
return apolloWrapper.mutate(CREATE_AIRCRAFT, {input: formData}).then(({data}) => {
- this.items.push(data.createAircraft);
+ // this.items.push(data.createAircraft);
return data.createAircraft;
- })
+ }).finally(() => this.isMutationRunning = false);
},
delete(id) {
return apolloWrapper.mutate(DELETE_AIRCRAFT, {id}).then(({data}) => {
@@ -36,11 +38,12 @@ export const useAircraftsStore = defineStore('Aircrafts', {
});
},
update(id, formData) {
+ this.isMutationRunning = true;
return apolloWrapper.mutate(EDIT_AIRCRAFT, {id: id, input: formData}).then(({data}) => {
const aircraft = data.editAircraft;
updateInItems(this.items, 'id', aircraft);
return aircraft;
- });
+ }).finally(() => this.isMutationRunning = false);
},
fetch() {
return apolloWrapper
diff --git a/src/stores/Flights.js b/src/stores/Flights.js
index fe11aa7..b435b9d 100644
--- a/src/stores/Flights.js
+++ b/src/stores/Flights.js
@@ -6,7 +6,8 @@ import {updateInItems} from "stores/helpers";
export const useFlightsStore = defineStore('Flights', {
state: () => ({
- items: []
+ items: [],
+ isMutationRunning: false
}),
getters: {
@@ -19,18 +20,24 @@ export const useFlightsStore = defineStore('Flights', {
create(formData) {
delete formData['id'];
return apolloWrapper.mutate(CREATE_FLIGHT, {input: formData}).then(({data}) => {
- this.items.push(data.createFlight);
+ const flightId = data.createFlight.id;
+
+ // pitomy ohack kvuli tomu, ze se mi nedari dostat z API rovnou informace o nove vytvorenem letadle
+ this.fetchDetail(flightId).then(flight => {
+ this.items.push(flight);
+ })
return data.createFlight;
})
},
update(id, formData) {
+ this.isMutationRunning = true;
return apolloWrapper.mutate(EDIT_FLIGHT, {id: id, input: formData}).then(({data}) => {
const flight = data.editFlight;
updateInItems(this.items, "id", flight);
return flight;
- });
+ }).finally(() => this.isMutationRunning = false);
},
fetchDetail(id, username = null) {
if (typeof id !== "number") {
diff --git a/src/stores/User.js b/src/stores/User.js
index 532c985..e36a533 100644
--- a/src/stores/User.js
+++ b/src/stores/User.js
@@ -8,15 +8,18 @@ export const useUserStore = defineStore('LoggedUser', {
state: () => ({
user: {},
isRefreshing: false,
+ isMutationRunning: false,
}),
actions: {
- update(id, formData) {
- apolloWrapper.mutate(EDIT_USER, {id, input: formData}).then((response) => {
+ update(formData) {
+ this.isMutationRunning = true;
+
+ apolloWrapper.mutate(EDIT_USER, {input: formData}).then((response) => {
const user = response.data?.editLoggedUser;
this.user = user;
return user;
- });
+ }).finally(() => this.isMutationRunning = false);
},
fetchLoggedUserDetail() {