Upravy UI, refaktoring, davkove upravy a mazani fotek
This commit is contained in:
@@ -4,18 +4,20 @@ import {createUploadLink} from 'apollo-upload-client';
|
||||
import {onError} from "@apollo/client/link/error";
|
||||
import {useUserStore} from "stores/User";
|
||||
import {useAppStore} from "stores/App";
|
||||
import {Notify} from "quasar";
|
||||
import {errorObject, warningObject} from "src/composables/dialog";
|
||||
|
||||
|
||||
const uploadLink = createUploadLink({
|
||||
uri: process.env.API_URL+'/graphql',
|
||||
uri: process.env.API_URL + '/graphql',
|
||||
})
|
||||
|
||||
const handleRefreshToken = (forward, operation) => {
|
||||
return fromPromise(
|
||||
useUserStore().refreshAccessToken()
|
||||
.catch((error) => {
|
||||
console.log("neumim refresh");
|
||||
// window.location = "/login";
|
||||
Notify.create(warningObject("Tvoje přihlášení vypřešlo. Přihlaš se prosím znovu."));
|
||||
window.location = "/login";
|
||||
})
|
||||
)
|
||||
.filter((value) => Boolean(value))
|
||||
@@ -40,17 +42,14 @@ const errorLink = onError(
|
||||
}
|
||||
|
||||
if (graphQLErrors) {
|
||||
const messages = [];
|
||||
for (const error of graphQLErrors) {
|
||||
if (error.message === "Not found") {
|
||||
useAppStore().appStatus = 404;
|
||||
} else if (error.message.includes("401") || error.message.includes("Not authorized")) {
|
||||
return handleRefreshToken(forward, operation);
|
||||
} else {
|
||||
messages.push(error.message);
|
||||
Notify.create(errorObject("API error: " + error.message));
|
||||
}
|
||||
|
||||
// TODO: zaridit zobrazeni erroru z messages
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -81,8 +80,7 @@ export const apolloWrapper = {
|
||||
})
|
||||
.then((response) => response)
|
||||
.catch(err => {
|
||||
console.log(err.message);
|
||||
// console.error("Error during query: ", err)
|
||||
console.error("Error during query: ", err)
|
||||
return err;
|
||||
})
|
||||
},
|
||||
|
||||
@@ -61,7 +61,6 @@ fragment flightFullInfo on Flight {
|
||||
...weatherFullInfo
|
||||
}
|
||||
|
||||
|
||||
aircraft {
|
||||
...aircraftFullInfo
|
||||
}
|
||||
|
||||
@@ -9,7 +9,10 @@ export const FRAGMENT_PHOTO_FULL_INFO = gql`
|
||||
name
|
||||
description
|
||||
flightId
|
||||
pointOfInterestId
|
||||
pointOfInterest {
|
||||
id
|
||||
name
|
||||
}
|
||||
isFlightCover
|
||||
gpsLatitude
|
||||
gpsLongitude
|
||||
|
||||
Reference in New Issue
Block a user