mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
add pinia to manage data
This commit is contained in:
22
ui/src/store/notice-manage.ts
Normal file
22
ui/src/store/notice-manage.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import request from '@/services'
|
||||
|
||||
export const useNoticeManageStore = defineStore('notice-manage', {
|
||||
state: () => {
|
||||
return {
|
||||
selectData: [],
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
selectAllNotice() {
|
||||
void request.get('http://localhost:8621/notice').then((response) => {
|
||||
this.selectData = response.data.data
|
||||
if (this.selectData.length !== 0) {
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
22
ui/src/store/notice-view.ts
Normal file
22
ui/src/store/notice-view.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import request from '@/services'
|
||||
|
||||
export const useNoticeViewStore = defineStore('notice-view', {
|
||||
state: () => {
|
||||
return {
|
||||
selectData: [],
|
||||
getLoading: true
|
||||
}
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
selectAllNoticeByUserId(): void {
|
||||
void request.get('http://localhost:8621/notice/ByUserId').then((response) => {
|
||||
this.selectData = response.data.data
|
||||
if (this.selectData.length !== 0) {
|
||||
this.getLoading = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user