Skip to content

Commit

Permalink
update stat
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariiiii committed Dec 11, 2024
1 parent 8887e94 commit d41e493
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions frontend/src/views/admin/Statistics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default {
notificationMessage: '',
notificationType: 'info',
showNotification: false,
reloadFlag: false,
userName: localStorage.getItem('userName') || 'Пользователь',
chartData: {
labels: [],
Expand All @@ -91,14 +92,12 @@ export default {
const response = await axios.get('http://127.0.0.1:5000/database_export', {
responseType: 'blob'
});
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'exported_data.json');
document.body.appendChild(link);
link.click();
this.showNotification = true;
this.notificationMessage = 'Данные успешно экспортированы';
this.notificationType = 'success';
Expand Down Expand Up @@ -139,12 +138,11 @@ export default {
'Content-Type': 'multipart/form-data'
}
});
localStorage.setItem('userType', response.data.userType);
localStorage.setItem('userName', response.data.userName);
localStorage.setItem('userName', response.data.adminName);
this.reloadFlag = true;
this.showNotification = true;
this.notificationMessage = 'Данные успешно импортированы';
this.notificationMessage = 'Данные успешно импортированы.';
this.notificationType = 'success';
} catch (error) {
this.showNotification = true;
this.notificationMessage = 'Ошибка при импорте данных';
Expand Down Expand Up @@ -203,6 +201,10 @@ export default {
closeNotification() {
this.showNotification = false;
if (this.reloadFlag == true) {
window.location.reload();
this.reloadFlag = false;
}
}
}
};
Expand Down Expand Up @@ -264,7 +266,6 @@ h1 {
.chart-container {
width: 70%;
}
.chart {
width: 100%;
max-width: 800px;
Expand Down

0 comments on commit d41e493

Please sign in to comment.