mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-10 06:07:54 +02:00
Replace the notify store with 2fauth/ui notifier & 2fauth/stores parser
This commit is contained in:
18
resources/js/stores/groups.js
vendored
18
resources/js/stores/groups.js
vendored
@ -1,6 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useNotifyStore } from '@/stores/notify'
|
||||
import { useNotify } from '@2fauth/ui'
|
||||
import groupService from '@/services/groupService'
|
||||
|
||||
export const useGroups = defineStore({
|
||||
@ -17,7 +17,8 @@ export const useGroups = defineStore({
|
||||
current(state) {
|
||||
const group = state.items.find(item => item.id === parseInt(useUserStore().preferences.activeGroup))
|
||||
|
||||
return group ? group.name : t('message.all')
|
||||
// TODO : restore translated prompt
|
||||
return group ? group.name : 'message.all'
|
||||
},
|
||||
|
||||
withoutTheAllGroup(state) {
|
||||
@ -47,11 +48,13 @@ export const useGroups = defineStore({
|
||||
|
||||
if (index > -1) {
|
||||
this.items[index] = group
|
||||
useNotifyStore().success({ text: t('message.groups.group_name_saved') })
|
||||
// TODO : restore translated message
|
||||
useNotify().success({ text: 'message.groups.group_name_saved' })
|
||||
}
|
||||
else {
|
||||
this.items.push(group)
|
||||
useNotifyStore().success({ text: t('message.groups.group_successfully_created') })
|
||||
// TODO : restore translated message
|
||||
useNotify().success({ text: 'message.groups.group_successfully_created' })
|
||||
}
|
||||
},
|
||||
|
||||
@ -78,10 +81,13 @@ export const useGroups = defineStore({
|
||||
async delete(id) {
|
||||
const user = useUserStore()
|
||||
|
||||
if (confirm(t('message.groups.confirm.delete'))) {
|
||||
// TODO : restore translated message
|
||||
// if (confirm(t('message.groups.confirm.delete'))) {
|
||||
if (confirm('message.groups.confirm.delete')) {
|
||||
await groupService.delete(id).then(response => {
|
||||
this.items = this.items.filter(a => a.id !== id)
|
||||
useNotifyStore().success({ text: t('message.groups.group_successfully_deleted') })
|
||||
// TODO : restore translated message
|
||||
useNotify().success({ text: 'message.groups.group_successfully_deleted' })
|
||||
|
||||
// Reset group filter to 'All' (groupId=0) since the backend has already made
|
||||
// the change automatically. This prevents a new request.
|
||||
|
Reference in New Issue
Block a user