ilk commit
This commit is contained in:
44
src/module/kullanicilar/service/appUserRoleService.ts
Normal file
44
src/module/kullanicilar/service/appUserRoleService.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useDataStore } from '@/stores/dataStore'
|
||||
import { useAppUserRoleStore } from '../stores/appUserRoleStore'
|
||||
import { useAppUserRoleValidationStore } from '../validation/appUserRoleValidationStore'
|
||||
|
||||
export const useAppUserRoleService = defineStore('appUserRoleService', () => {
|
||||
const dataStore = useDataStore()
|
||||
const appUserRoleStore = useAppUserRoleStore()
|
||||
const appUserRoleValidationStore = useAppUserRoleValidationStore()
|
||||
|
||||
const GetAppUserRoleList = async () => {
|
||||
if (appUserRoleStore.appUserRoles.length === 0) {
|
||||
let data = await dataStore.dataGet('KullaniciGorevi')
|
||||
appUserRoleStore.appUserRoles = data
|
||||
}
|
||||
}
|
||||
|
||||
const SaveRole = async () => {
|
||||
if (appUserRoleValidationStore.FormCheck()) {
|
||||
if (appUserRoleStore.appUserRoleForm.appUsers === null)
|
||||
appUserRoleStore.appUserRoleForm.appUsers = []
|
||||
let dt: any
|
||||
if (!appUserRoleStore.isUpdate) {
|
||||
dt = await dataStore.dataPost('KullaniciGorevi', {
|
||||
data: appUserRoleStore.appUserRoleForm
|
||||
})
|
||||
} else {
|
||||
dt = await dataStore.dataPut('KullaniciGorevi/' + appUserRoleStore.appUserRoleForm.id, {
|
||||
data: appUserRoleStore.appUserRoleForm
|
||||
})
|
||||
}
|
||||
if (dt !== 'errorfalse') {
|
||||
appUserRoleStore.refreshList = true
|
||||
appUserRoleStore.isUpdate = false
|
||||
appUserRoleStore.rolePanel = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
GetAppUserRoleList,
|
||||
SaveRole
|
||||
}
|
||||
})
|
||||
11
src/module/kullanicilar/service/appUserService.ts
Normal file
11
src/module/kullanicilar/service/appUserService.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useDataStore } from '@/stores/dataStore'
|
||||
import { useAppUserStore } from '../stores/appUserStore'
|
||||
|
||||
export const useAppUserService = defineStore('appUserService', () => {
|
||||
const dataStore = useDataStore()
|
||||
const appUserStore = useAppUserStore()
|
||||
|
||||
return {
|
||||
}
|
||||
})
|
||||
44
src/module/kullanicilar/service/appUserUnitService.ts
Normal file
44
src/module/kullanicilar/service/appUserUnitService.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useDataStore } from '@/stores/dataStore'
|
||||
import { useAppUserUnitStore } from '../stores/appUserUnitStore'
|
||||
import { useAppUserUnitValidationStore } from '../validation/appUserUnitValidationStore'
|
||||
|
||||
export const useAppUserUnitService = defineStore('appUserUnitService', () => {
|
||||
const dataStore = useDataStore()
|
||||
const appUserUnitStore = useAppUserUnitStore()
|
||||
const appUserUnitValidationStore = useAppUserUnitValidationStore()
|
||||
|
||||
const GetAppUserUnitList = async () => {
|
||||
if (appUserUnitStore.appUserUnits.length === 0) {
|
||||
let data = await dataStore.dataGet('Birim')
|
||||
appUserUnitStore.appUserUnits = data
|
||||
}
|
||||
}
|
||||
|
||||
const SaveUnit = async () => {
|
||||
if (appUserUnitValidationStore.FormCheck()) {
|
||||
if (appUserUnitStore.appUserUnitForm.appUsers === null)
|
||||
appUserUnitStore.appUserUnitForm.appUsers = []
|
||||
let dt: any
|
||||
if (!appUserUnitStore.isUpdate) {
|
||||
dt = await dataStore.dataPost('Birim', {
|
||||
data: appUserUnitStore.appUserUnitForm
|
||||
})
|
||||
} else {
|
||||
dt = await dataStore.dataPut('Birim/' + appUserUnitStore.appUserUnitForm.id, {
|
||||
data: appUserUnitStore.appUserUnitForm
|
||||
})
|
||||
}
|
||||
if (dt !== 'errorfalse') {
|
||||
appUserUnitStore.refreshList = true
|
||||
appUserUnitStore.isUpdate = false
|
||||
appUserUnitStore.unitPanel = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
GetAppUserUnitList,
|
||||
SaveUnit
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user