+
{{ photo.name }}
diff --git a/src/components/profile/ProfileForm.vue b/src/components/profile/ProfileForm.vue
index 45e5dd5..eae3036 100644
--- a/src/components/profile/ProfileForm.vue
+++ b/src/components/profile/ProfileForm.vue
@@ -13,9 +13,9 @@ const props = defineProps({
}
});
const formData = reactive({
- name: null,
- publicUsername: null,
- description: null,
+ name: '',
+ publicUsername: '',
+ description: '',
avatarImage: null,
titleImage: null,
});
diff --git a/src/components/weather/WeatherInfo.vue b/src/components/weather/WeatherInfo.vue
index dbf17cd..7490d57 100644
--- a/src/components/weather/WeatherInfo.vue
+++ b/src/components/weather/WeatherInfo.vue
@@ -18,7 +18,7 @@ const openDetail = ref(false);
-
+
diff --git a/src/composables/objects/flight.js b/src/composables/objects/flight.js
index a7094f6..d44a6fc 100644
--- a/src/composables/objects/flight.js
+++ b/src/composables/objects/flight.js
@@ -3,6 +3,7 @@ import {useFlightsStore} from "stores/Flights";
import {ref} from "vue";
import {storeToRefs} from "pinia";
import {confirmObject} from "src/composables/dialog";
+import {useAppStore} from "stores/App";
export const flightName = (flight) => {
const date = formatDatetime(flight.takeoffDatetime, FORMAT_DATE);
@@ -15,9 +16,9 @@ export const flightName = (flight) => {
export const loading = ref(true);
export const flight = ref(null);
-export const fetchFlight = (flightId) => {
+export const fetchFlight = (flightId, username) => {
loading.value = true;
- return useFlightsStore().fetchDetail(parseInt(flightId))
+ return useFlightsStore().fetchDetail(parseInt(flightId), username)
.then(respFlight => {
flight.value = respFlight;
return respFlight;
@@ -42,4 +43,3 @@ export const handleDeleteFlight = ($q, flightId, onOkCallback = () => {
useFlightsStore().delete(flightId).then(onOkCallback);
});
};
-
diff --git a/src/css/app.scss b/src/css/app.scss
index ecac98f..80ea12e 100644
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -1 +1,8 @@
// app global css in SCSS form
+
+.flight-detail-card {
+ width: 100%;
+ max-width: 700px;
+ margin-left: auto;
+ margin-right: auto;
+}
diff --git a/src/graphql/apollo.js b/src/graphql/apollo.js
index d0cc384..51556af 100644
--- a/src/graphql/apollo.js
+++ b/src/graphql/apollo.js
@@ -3,7 +3,8 @@ import {createApolloProvider} from "@vue/apollo-option";
import {createUploadLink} from 'apollo-upload-client';
import {onError} from "@apollo/client/link/error";
import {useUserStore} from "stores/User";
-import {useRouter} from "vue-router";
+import {useRoute, useRouter} from "vue-router";
+import {useAppStore} from "stores/App";
const uploadLink = createUploadLink({
@@ -15,7 +16,7 @@ const errorLink = onError(
if (networkError?.statusCode === 401) {
return fromPromise(
useUserStore().refreshAccessToken().catch((error) => {
- useRouter().push({to: "login"});
+ useAppStore().appStatus = 401;
})
)
.filter((value) => Boolean(value))
@@ -32,6 +33,21 @@ const errorLink = onError(
return forward(operation);
});
}
+
+ if (graphQLErrors) {
+ const messages = [];
+
+ for (const error of graphQLErrors) {
+ if (error.message === "Not found") {
+ useAppStore().appStatus = 404;
+ }
+
+ if (error.message === "Not authenticated") {
+ window.location = "/login";
+ }
+ }
+ console.log(graphQLErrors)
+ }
});
const authLink = new ApolloLink((operation, forward) => {
@@ -60,7 +76,9 @@ export const apolloWrapper = {
})
.then((response) => response)
.catch(err => {
- console.error("Error during query: ", err)
+ console.log(err.message);
+ // console.error("Error during query: ", err)
+ return err;
})
},
diff --git a/src/graphql/fragments/airport.js b/src/graphql/fragments/airport.js
index 9bb6e2a..13edd6c 100644
--- a/src/graphql/fragments/airport.js
+++ b/src/graphql/fragments/airport.js
@@ -2,6 +2,7 @@ import gql from "graphql-tag";
export const FRAGMENT_AIRPORT_INFO = gql`
fragment airportInfo on Airport {
+ id
name
icaoCode
gpsLatitude
diff --git a/src/graphql/fragments/flight.js b/src/graphql/fragments/flight.js
index fba2bfa..c159ea8 100644
--- a/src/graphql/fragments/flight.js
+++ b/src/graphql/fragments/flight.js
@@ -37,6 +37,11 @@ fragment flightFullInfo on Flight {
...airportInfo
}
+ copilot {
+ id
+ name
+ }
+
gpxTrackUrl
track {
pointOfInterest {
@@ -103,15 +108,3 @@ ${FRAGMENT_AIRPORT_INFO}
${FRAGMENT_AIRCRAFT_BASIC_INFO}
`
-export const FRAGMENT_FLIGHT_EDIT_IDS = gql`
-fragment flightEditIds on Flight {
- landingAirportId
- takeoffAirportId
- aircraftId
- copilotId
- copilot {
- id
- name
- }
-}
-`;
diff --git a/src/graphql/queries/flights.js b/src/graphql/queries/flights.js
index 4d870bd..b65d0eb 100644
--- a/src/graphql/queries/flights.js
+++ b/src/graphql/queries/flights.js
@@ -1,5 +1,5 @@
import gql from "graphql-tag";
-import {FRAGMENT_FLIGHT_EDIT_IDS, FRAGMENT_FLIGHT_FULL_INFO, FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight";
+import {FRAGMENT_FLIGHT_FULL_INFO, FRAGMENT_FLIGHT_LIST_INFO} from "src/graphql/fragments/flight";
export const FLIGHTS_LIST = gql`
query FlightsList {
@@ -14,11 +14,9 @@ export const FLIGHT_DETAIL = gql`
query FlightDetail($id: Int!) {
flight(id: $id) {
...flightFullInfo
- ...flightEditIds
}
}
${FRAGMENT_FLIGHT_FULL_INFO}
-${FRAGMENT_FLIGHT_EDIT_IDS}
`;
diff --git a/src/layouts/PlainLayout.vue b/src/layouts/PlainLayout.vue
new file mode 100644
index 0000000..06e395d
--- /dev/null
+++ b/src/layouts/PlainLayout.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/layouts/PublicLayout.vue b/src/layouts/PublicLayout.vue
index 455bf10..1cc3ca7 100644
--- a/src/layouts/PublicLayout.vue
+++ b/src/layouts/PublicLayout.vue
@@ -3,7 +3,7 @@
- Polétání.cz
+ {{ pageTitle ? `${pageTitle} | Polétání.cz` : "Polétání.cz" }}
@@ -26,7 +26,8 @@
-
+
+
@@ -37,8 +38,9 @@ import {useUserStore} from "stores/User";
import {onMounted} from "vue";
import {useAppStore} from "stores/App";
import {useMeta} from "quasar";
+import BreadcrumbsNavigation from "components/BreadcrumbsNavigation.vue";
-const {pageTitle} = storeToRefs(useAppStore());
+const {pageTitle, breadcrumbs} = storeToRefs(useAppStore());
const loggedUser = storeToRefs(useUserStore()).user;
useMeta(() => ({
diff --git a/src/pages/ErrorNotFound.vue b/src/pages/ErrorNotFound.vue
index c1c178b..b227151 100644
--- a/src/pages/ErrorNotFound.vue
+++ b/src/pages/ErrorNotFound.vue
@@ -1,12 +1,11 @@
-
+
-
- 404
-
-
- Oops. Nothing here...
+
+
+
+ 404
diff --git a/src/pages/profile/details/FlightDetailPage.vue b/src/pages/profile/details/FlightDetailPage.vue
index f5488f0..975a10a 100644
--- a/src/pages/profile/details/FlightDetailPage.vue
+++ b/src/pages/profile/details/FlightDetailPage.vue
@@ -1,28 +1,24 @@
@@ -107,63 +70,43 @@ const togglePublicVisibility = () => {
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
- {{ flight.isPublic ? 'je verejny' : 'neni verejny'}}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/pages/public/FlightDetailPage.vue b/src/pages/public/FlightDetailPage.vue
index 1a686f0..3068a64 100644
--- a/src/pages/public/FlightDetailPage.vue
+++ b/src/pages/public/FlightDetailPage.vue
@@ -1,9 +1,50 @@
-
- Detail letu
-
+
+
+
+
+
+
+ Pozor! Tento let není publikován a nebude tak dostupný pro ostatní!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/public/IndexPage.vue b/src/pages/public/IndexPage.vue
index a9d0f97..f965b2f 100644
--- a/src/pages/public/IndexPage.vue
+++ b/src/pages/public/IndexPage.vue
@@ -3,8 +3,9 @@
+
+
Pochlub se svým polétáním!
-
Login
-
Register
-
+
Létáš? Kam si archivuješ fotky a trasy? Polétání.cz je aplikace pro sdílení informací o tvých výletech vzduchem.
+
diff --git a/src/pages/public/LoginPage.vue b/src/pages/public/LoginPage.vue
index 37ca2b7..6ee60a0 100644
--- a/src/pages/public/LoginPage.vue
+++ b/src/pages/public/LoginPage.vue
@@ -17,7 +17,7 @@ const logUser = () => {
-
+
Login
@@ -36,10 +36,10 @@ const logUser = () => {
-
+
- Forgot your password?
+ Zapomenuté heslo
diff --git a/src/pages/public/PilotProfilePage.vue b/src/pages/public/PilotProfilePage.vue
index 4cb0e5e..e3f5c59 100644
--- a/src/pages/public/PilotProfilePage.vue
+++ b/src/pages/public/PilotProfilePage.vue
@@ -45,13 +45,11 @@ const flights = storeToRefs(useFlightsStore()).items;
- Lety
-
-
+
@@ -63,10 +61,11 @@ const flights = storeToRefs(useFlightsStore()).items;
{{ pilot.name }}
+
+ Registrován: {{ formatDatetime(pilot.createdAt, FORMAT_DATE) }}
+
-
- Registrován: {{ formatDatetime(pilot.createdAt, FORMAT_DATE) }}
diff --git a/src/pages/public/PublicFlightsPage.vue b/src/pages/public/PublicFlightsPage.vue
deleted file mode 100644
index e69de29..0000000
diff --git a/src/pages/public/RegisterPage.vue b/src/pages/public/RegisterPage.vue
index 6c2d264..a1fd890 100644
--- a/src/pages/public/RegisterPage.vue
+++ b/src/pages/public/RegisterPage.vue
@@ -37,43 +37,37 @@ const registerUser = () => {
-
-
-
-
-
- Registration
-
-
-
-
-
-
-
-
+
+
+
+ Registrace
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Return to login
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Zpět na login
+
+
diff --git a/src/router/routes.js b/src/router/routes.js
index 62f7e85..b050e48 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -1,11 +1,14 @@
+import PlainLayout from "layouts/PlainLayout.vue";
+
const routes = [
+ {path: '/login', name: "login", component: () => import('pages/public/LoginPage.vue'), meta: {layout: PlainLayout}},
+ {path: '/register', name: "registration", component: () => import('pages/public/RegisterPage.vue'), meta: {layout: PlainLayout}},
+ {path: '/forgotten-password', name: "forgottenPassword", component: () => import('pages/public/RegisterPage.vue'), meta: {layout: PlainLayout}},
{
path: '/',
component: () => import('layouts/PublicLayout.vue'),
children: [
{path: '', name: "homepage", component: () => import('pages/public/IndexPage.vue')},
- {path: 'login', name: "login", component: () => import('pages/public/LoginPage.vue')},
- {path: 'register', name: "registration", component: () => import('pages/public/RegisterPage.vue')},
{path: 'about', name: "about", component: () => import('pages/public/AboutPage.vue')},
{path: ':username', name: "publicProfileDetail", component: () => import('pages/public/PilotProfilePage.vue')},
{path: ':username/:id', name: "publicFlightDetail", component: () => import('pages/public/FlightDetailPage.vue')},
diff --git a/src/stores/App.js b/src/stores/App.js
index bd8a5fe..f79e278 100644
--- a/src/stores/App.js
+++ b/src/stores/App.js
@@ -3,12 +3,14 @@ import {defineStore} from 'pinia'
export const useAppStore = defineStore('App', {
state: () => ({
pageTitle: null,
- breadcrumbs: []
+ breadcrumbs: [],
+ appStatus: 200
}),
actions: {
resetAfterRouteChange() {
this.setPageTitle("");
this.setBreadcrumbs([]);
+ this.appStatus = 200;
},
setPageTitle(pageTitle) {
this.pageTitle = pageTitle;
diff --git a/src/stores/Flights.js b/src/stores/Flights.js
index af74ae3..c24522d 100644
--- a/src/stores/Flights.js
+++ b/src/stores/Flights.js
@@ -25,15 +25,22 @@ export const useFlightsStore = defineStore('Flights', {
},
update(id, formData) {
return apolloWrapper.mutate(EDIT_FLIGHT, {id: id, input: formData}).then(({data}) => {
- console.log("Pridat update ve storu")
- return data.editFlight;
+ const flight = data.editFlight;
+ const idx = this.items.findIndex(item => item.id === id);
+ if (idx < 0) {
+ this.items.push(flight)
+ } else {
+ this.items[idx] = flight;
+ }
+
+ return flight;
});
},
- fetchDetail(id) {
+ fetchDetail(id, username) {
if (typeof id !== "number") {
id = parseInt(id);
}
- return apolloWrapper.query(FLIGHT_DETAIL, {id}).then(result => result.data.flight);
+ return apolloWrapper.query(FLIGHT_DETAIL, {id, username}).then(result => result.data.flight);
},
fetch(username) {
return apolloWrapper
diff --git a/src/stores/User.js b/src/stores/User.js
index b5089df..ee06184 100644
--- a/src/stores/User.js
+++ b/src/stores/User.js
@@ -12,22 +12,24 @@ export const useUserStore = defineStore('LoggedUser', {
actions: {
update(id, formData) {
- apolloWrapper.mutate(EDIT_USER, {id, input: formData}).then(({data}) => {
- this.user = data.editLoggedUser;
- return data.editLoggedUser;
+ apolloWrapper.mutate(EDIT_USER, {id, input: formData}).then((response) => {
+ const user = response.data?.editLoggedUser;
+ this.user = user;
+ return user;
});
},
fetchLoggedUserDetail() {
- return apolloWrapper.query(LOGGED_USER_DETAIL).then(({data}) => {
- this.user = data.loggedUser;
- return data.loggedUser;
+ return apolloWrapper.query(LOGGED_USER_DETAIL).then((response) => {
+ const user = response.data?.loggedUser;
+ this.user = user;
+ return user;
})
},
fetchDetail(username) {
- return apolloWrapper.query(USER_DETAIL, {username}).then(({data}) => {
- return data.user
+ return apolloWrapper.query(USER_DETAIL, {username}).then((response) => {
+ return response.data?.user;
});
},