fix types
Gitea Actions Demo / build_and_push (push) Successful in 1m38s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m38s
Details
This commit is contained in:
parent
2038ca5322
commit
8b8f5fc3c1
|
|
@ -8,6 +8,7 @@ import router from "./router";
|
|||
import vuesticGlobalConfig from "./services/vuestic-ui/global-config";
|
||||
import App from "./App.vue";
|
||||
import axios from 'axios';
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
const HOST = "https://cycle-rider.ru";
|
||||
// const HOST = "http://localhost:8000";
|
||||
|
|
@ -31,7 +32,7 @@ axiosAuth.interceptors.request.use(
|
|||
return Promise.reject(error)
|
||||
}
|
||||
);
|
||||
function httpErrorHandler(error) {
|
||||
function httpErrorHandler(error: any) {
|
||||
if (error === null) throw new Error('Unrecoverable error!! Error is null!')
|
||||
if (axios.isAxiosError(error)) {
|
||||
//here we have a type guard check, error inside this if will be treated as AxiosError
|
||||
|
|
@ -65,7 +66,7 @@ function responseHandler(response: AxiosResponse<any>) {
|
|||
return response
|
||||
}
|
||||
|
||||
function responseErrorHandler(response) {
|
||||
function responseErrorHandler(response: any) {
|
||||
const config = response?.config
|
||||
if (config.raw) {
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -18,8 +18,9 @@ import { inject } from 'vue'
|
|||
import { ref } from "vue";
|
||||
import { useForm, useToast } from "vuestic-ui";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { AxiosResponse, AxiosInstance } from "axios";
|
||||
|
||||
const axiosAuth = inject('axiosAuth');
|
||||
const axiosAuth = inject('axiosAuth') as AxiosInstance;
|
||||
const form = useForm("passwordForm");
|
||||
const code = ref("");
|
||||
const router = useRouter();
|
||||
|
|
@ -33,7 +34,7 @@ const submit = () => {
|
|||
email: email.value,
|
||||
code: code.value,
|
||||
})
|
||||
.then((response) => {
|
||||
.then((response: AxiosResponse) => {
|
||||
|
||||
localStorage.setItem('token', response.data.token);
|
||||
localStorage.setItem('profile', JSON.stringify(response.data.profile));
|
||||
|
|
@ -41,7 +42,7 @@ const submit = () => {
|
|||
localStorage.setItem('attachments', JSON.stringify(response.data.attachments));
|
||||
|
||||
router.push({ name: "dashboard" }).catch((error) => { });
|
||||
}).catch((error) => {
|
||||
}).catch((error: any) => {
|
||||
if (error.response.data.detail.code_string == "ObjectNotFound") {
|
||||
init({
|
||||
message: "Неверный код",
|
||||
|
|
|
|||
|
|
@ -25,13 +25,14 @@
|
|||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { AxiosResponse, AxiosInstance } from "axios";
|
||||
import { inject } from 'vue'
|
||||
import { VaFileUpload } from "vuestic-ui";
|
||||
import { useUserStore } from "../../../stores/user-store";
|
||||
import { useToast } from "vuestic-ui/web-components";
|
||||
import { ref } from 'vue';
|
||||
|
||||
const axiosAuth = inject('axiosAuth');
|
||||
const axiosAuth = inject('axiosAuth') as AxiosInstance;
|
||||
const store = useUserStore();
|
||||
const { init } = useToast();
|
||||
const avatar = ref(store.avatar);
|
||||
|
|
@ -51,7 +52,7 @@ let file: {
|
|||
function onFileChanged() {
|
||||
var formData = new FormData();
|
||||
formData.append("file", file);
|
||||
axiosAuth.post(`/api/v0/attachment/upload`, formData, ).then(function (response) {
|
||||
axiosAuth.post(`/api/v0/attachment/upload`, formData, ).then(function (response: AxiosResponse) {
|
||||
let dataUser = JSON.parse(localStorage.getItem("user")!);
|
||||
dataUser["attachment_id"] = response.data.id;
|
||||
store.changeAvatar(response.data.url);
|
||||
|
|
@ -60,10 +61,10 @@ function onFileChanged() {
|
|||
.patch(`/api/v0/profiles/${store.profileID}`, {
|
||||
"user": dataUser,
|
||||
})
|
||||
.then((response) => {
|
||||
.then((response: any) => {
|
||||
init({ message: "Фото успешно загружено!", color: "success" });
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
init({
|
||||
message: "Что-то пошло не так.",
|
||||
color: "error",
|
||||
|
|
@ -71,7 +72,7 @@ function onFileChanged() {
|
|||
|
||||
});
|
||||
})
|
||||
.catch(function (error) {
|
||||
.catch(function (error: any) {
|
||||
init({
|
||||
message: "Что-то пошло не так.",
|
||||
color: "error",
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@
|
|||
/>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { AxiosResponse, AxiosInstance } from "axios";
|
||||
import { inject } from 'vue'
|
||||
import { VaFileUpload } from "vuestic-ui";
|
||||
import { useToast } from "vuestic-ui/web-components";
|
||||
|
||||
const axiosAuth = inject('axiosAuth');
|
||||
const axiosAuth= inject('axiosAuth') as AxiosInstance;
|
||||
const { init } = useToast();
|
||||
|
||||
let file: {
|
||||
|
|
@ -36,7 +37,7 @@ function onFileChanged() {
|
|||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem("token")}`,
|
||||
}
|
||||
}).then(function (response) {
|
||||
}).then(function (response: AxiosResponse) {
|
||||
axiosAuth
|
||||
.post(`/api/v0/workouts`, {
|
||||
"attachment_id": response.data.id,
|
||||
|
|
@ -44,10 +45,10 @@ function onFileChanged() {
|
|||
}, {
|
||||
headers: { Authorization: `Bearer ${localStorage.getItem("token")}` }
|
||||
})
|
||||
.then((response) => {
|
||||
.then((response: AxiosResponse) => {
|
||||
init({ message: "Тренировка успешно загружена!", color: "success" });
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: any) => {
|
||||
init({
|
||||
message: "Что-то пошло не так.",
|
||||
color: "error",
|
||||
|
|
@ -55,7 +56,7 @@ function onFileChanged() {
|
|||
|
||||
});
|
||||
})
|
||||
.catch(function (error) {
|
||||
.catch(function (error: any) {
|
||||
init({
|
||||
message: "Что-то пошло не так.",
|
||||
color: "error",
|
||||
|
|
|
|||
Loading…
Reference in New Issue