появление тренировки
Gitea Actions Demo / build_and_push (push) Successful in 1m17s Details

This commit is contained in:
artem 2026-10-03 19:58:09 +03:00
parent c598b1a57f
commit f5bf68178f
4 changed files with 13 additions and 8 deletions

View File

@ -85,10 +85,12 @@ import axios from "axios";
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useForm, useToast } from "vuestic-ui"; import { useForm, useToast } from "vuestic-ui";
import { useGlobalStore } from "../../stores/global-store";
const { validate } = useForm("form"); const { validate } = useForm("form");
const { push } = useRouter(); const { push } = useRouter();
const { init } = useToast(); const { init } = useToast();
const globalStore = useGlobalStore();
const formData = reactive({ const formData = reactive({
email: "", email: "",
@ -121,6 +123,7 @@ const submit = () => {
"attachments", "attachments",
JSON.stringify(response.data.attachments), JSON.stringify(response.data.attachments),
); );
globalStore.setAuthenticated(true);
init({ init({
message: "Вы успешно вошли", message: "Вы успешно вошли",
color: "success", color: "success",

View File

@ -17,8 +17,8 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { AxiosError } from "axios"; import { AxiosError, AxiosInstance } from "axios";
import { ref } from "vue"; import { ref, inject } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useToast } from "vuestic-ui/web-components"; import { useToast } from "vuestic-ui/web-components";
import WorkoutItemComponent from "./components/WorkoutItem.vue"; import WorkoutItemComponent from "./components/WorkoutItem.vue";
@ -27,6 +27,7 @@ import { GetWorkout, InitWorkoutItem } from "./components/GetWorkout";
const { init } = useToast(); const { init } = useToast();
const route = useRoute(); const route = useRoute();
const axiosAuth = inject("axiosAuth") as AxiosInstance;
const mapCenter = ref<Array<number>>([37.617644, 55.755819]); const mapCenter = ref<Array<number>>([37.617644, 55.755819]);
const lineCoordinates = ref<Array<Array<number>>>([]); const lineCoordinates = ref<Array<Array<number>>>([]);
@ -37,7 +38,7 @@ const dzenLink = ref("");
const dataKey = ref(0); const dataKey = ref(0);
const initWorkout = (id: string) => { const initWorkout = (id: string) => {
GetWorkout(`/api/v0/workouts/${id}`) GetWorkout(`/api/v0/workouts/${id}`, axiosAuth)
.then((d: InitWorkoutItem) => { .then((d: InitWorkoutItem) => {
mapCenter.value = d.mapCenter; mapCenter.value = d.mapCenter;
lineCoordinates.value = d.lineCoordinates; lineCoordinates.value = d.lineCoordinates;

View File

@ -15,8 +15,8 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { AxiosError } from "axios"; import { AxiosError, AxiosInstance } from "axios";
import { ref } from "vue"; import { ref, inject } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useToast } from "vuestic-ui/web-components"; import { useToast } from "vuestic-ui/web-components";
import WorkoutItemComponent from "./components/WorkoutItem.vue"; import WorkoutItemComponent from "./components/WorkoutItem.vue";
@ -26,6 +26,7 @@ import { trimTrack } from "./components/TrimTrack";
const { init } = useToast(); const { init } = useToast();
const route = useRoute(); const route = useRoute();
const axiosAuth = inject("axiosAuth") as AxiosInstance;
const mapCenter = ref<Array<number>>([37.617644, 55.755819]); const mapCenter = ref<Array<number>>([37.617644, 55.755819]);
const lineCoordinates = ref<Array<Array<number>>>([]); const lineCoordinates = ref<Array<Array<number>>>([]);
@ -35,7 +36,7 @@ const data = ref<ChartDataByMetric>({});
const dzenLink = ref(""); const dzenLink = ref("");
const initWorkout = (id: string) => { const initWorkout = (id: string) => {
GetWorkout(`/api/v0/public/workouts/${id}`) GetWorkout(`/api/v0/public/workouts/${id}`, axiosAuth)
.then((d: InitWorkoutItem) => { .then((d: InitWorkoutItem) => {
workoutItem.value = d.workoutItem; workoutItem.value = d.workoutItem;
if (d.dzenLink != undefined) { if (d.dzenLink != undefined) {

View File

@ -32,8 +32,8 @@ export type InitWorkoutItem = {
dzenLink?: string; dzenLink?: string;
}; };
export const GetWorkout = (url: string) => { export const GetWorkout = (url: string, axiosInstance?: AxiosInstance) => {
const axiosAuth = inject("axiosAuth") as AxiosInstance; const axiosAuth = axiosInstance ?? (inject("axiosAuth") as AxiosInstance);
const query = axiosAuth.get(url).then((response: AxiosResponse) => { const query = axiosAuth.get(url).then((response: AxiosResponse) => {
workoutItem = response.data.workout; workoutItem = response.data.workout;
const times = []; const times = [];