Account itself deletable
This commit is contained in:
@@ -139,3 +139,14 @@ account.patch("/", (req: Request, res: Response) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
account.delete("/:id", (req: Request, res: Response) => {
|
||||||
|
Account.destroy({
|
||||||
|
where: {
|
||||||
|
id: req.params.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(account => {
|
||||||
|
res.status(200).send()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -20,4 +20,8 @@ export async function registerAccount(account: AccountModel) {
|
|||||||
|
|
||||||
export async function updateAccount(account: AccountModel) {
|
export async function updateAccount(account: AccountModel) {
|
||||||
return await axios.patch(BASE_URL, account)
|
return await axios.patch(BASE_URL, account)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function deleteAccount(account: AccountModel) {
|
||||||
|
return await axios.delete(BASE_URL + "/" + account.id)
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,6 @@ const accountStore = useAccountStore()
|
|||||||
v-model="showConfirmDialog"
|
v-model="showConfirmDialog"
|
||||||
:title="$t('account.deleteAccount.dialog.title')"
|
:title="$t('account.deleteAccount.dialog.title')"
|
||||||
:description="$t('account.deleteAccount.dialog.description')"
|
:description="$t('account.deleteAccount.dialog.description')"
|
||||||
|
:on-confirm="() => accountStore.deleteAccount(accountStore.userAccount)"
|
||||||
/>
|
/>
|
||||||
<!-- todo :onConfirm="deleteAccount" -->
|
|
||||||
</template>
|
</template>
|
||||||
@@ -60,6 +60,7 @@ async function startLogin() {
|
|||||||
append-icon="mdi-arrow-right"
|
append-icon="mdi-arrow-right"
|
||||||
@click="startLogin"
|
@click="startLogin"
|
||||||
:loading="accountStore.fetchInProgress"
|
:loading="accountStore.fetchInProgress"
|
||||||
|
color="green"
|
||||||
>
|
>
|
||||||
{{ $t('account.login.login') }}
|
{{ $t('account.login.login') }}
|
||||||
</outlined-button>
|
</outlined-button>
|
||||||
|
|||||||
@@ -38,12 +38,7 @@ concertStore.getConcert(Number(router.currentRoute.value.params.id))
|
|||||||
:link="false"
|
:link="false"
|
||||||
:title="concertStore.concert.location.city.name"
|
:title="concertStore.concert.location.city.name"
|
||||||
:show-button="false"
|
:show-button="false"
|
||||||
>
|
/>
|
||||||
<template #description>
|
|
||||||
<p>{{ concertStore.concert.location.name }}</p>
|
|
||||||
<!-- todo <p>{{ concertModel.event.band.name }} - {{ concertModel.event.name }}</p> -->
|
|
||||||
</template>
|
|
||||||
</concert-list-item>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row>
|
<v-row>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useLocalStorage } from "@vueuse/core";
|
import { useLocalStorage } from "@vueuse/core";
|
||||||
import { defineStore } from "pinia";
|
import { acceptHMRUpdate, defineStore } from "pinia";
|
||||||
import { AccountModel } from "../data/models/user/accountModel";
|
import { AccountModel } from "../data/models/user/accountModel";
|
||||||
import { OrderModel } from "../data/models/ordering/orderModel";
|
import { OrderModel } from "../data/models/ordering/orderModel";
|
||||||
import { useFeedbackStore } from "./feedback.store";
|
import { useFeedbackStore } from "./feedback.store";
|
||||||
import { fetchAllAccounts, loginAccount, registerAccount, updateAccount } from "../data/api/accountApi";
|
import { deleteAccount, fetchAllAccounts, loginAccount, registerAccount, updateAccount } from "../data/api/accountApi";
|
||||||
import { fetchUserOrders } from "../data/api/orderApi";
|
import { fetchUserOrders } from "../data/api/orderApi";
|
||||||
import { BannerStateEnum } from "../data/enums/bannerStateEnum";
|
import { BannerStateEnum } from "../data/enums/bannerStateEnum";
|
||||||
import { AddressModel } from "../data/models/user/addressModel";
|
import { AddressModel } from "../data/models/user/addressModel";
|
||||||
@@ -191,8 +191,13 @@ export const useAccountStore = defineStore("accountStore", {
|
|||||||
// todo
|
// todo
|
||||||
},
|
},
|
||||||
|
|
||||||
async deleteAccount(item: AccountModel) {
|
async deleteAccount(account: AccountModel) {
|
||||||
// todo
|
this.fetchInProgress = true
|
||||||
|
|
||||||
|
deleteAccount(account)
|
||||||
|
.then(response => {
|
||||||
|
this.fetchInProgress = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user