Compare commits
5 Commits
a28576960e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 51d8f0822f | |||
|
|
a2215b9363 | ||
|
|
20e4a15286 | ||
|
|
29ca0b9965 | ||
|
|
f54c5660ea |
12
db/migration/base/004.up.company to cm.sql
Normal file
12
db/migration/base/004.up.company to cm.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
alter table company
|
||||||
|
rename to cm;
|
||||||
|
|
||||||
|
alter table cm
|
||||||
|
rename column title to name;
|
||||||
|
|
||||||
|
alter table company_usr
|
||||||
|
rename to cm_usr;
|
||||||
|
|
||||||
|
alter table cm_usr
|
||||||
|
rename column company_id to cm_id;
|
||||||
|
|
||||||
3
db/migration/base/005.up.cm_usr_cmid.sql
Normal file
3
db/migration/base/005.up.cm_usr_cmid.sql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
alter table cm_usr drop constraint uq_company_usr;
|
||||||
|
alter table cm_usr rename cm_id to cmid;
|
||||||
|
alter table cm_usr add constraint uq_cm_usr unique (cmid, usr_id);
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
-- << Create
|
-- << Create
|
||||||
insert into company ( clid
|
insert into cm ( clid
|
||||||
, code
|
, code
|
||||||
, title
|
, name
|
||||||
, is_active
|
, is_active
|
||||||
, notes
|
, notes
|
||||||
, tmpl)
|
, tmpl)
|
||||||
values ( @clid
|
values ( @clid
|
||||||
, @code
|
, @code
|
||||||
, @title
|
, @name
|
||||||
, @is_active
|
, @is_active
|
||||||
, @notes
|
, @notes
|
||||||
, @tmpl)
|
, @tmpl)
|
||||||
@@ -18,20 +18,19 @@ returning id
|
|||||||
select clid
|
select clid
|
||||||
, id
|
, id
|
||||||
, code
|
, code
|
||||||
, title
|
, name
|
||||||
, is_active
|
, is_active
|
||||||
, notes
|
, notes
|
||||||
, tmpl
|
, tmpl
|
||||||
|
|
||||||
from company
|
from cm
|
||||||
where id = $1
|
where id = $1
|
||||||
-- Read >>
|
-- Read >>
|
||||||
|
|
||||||
-- << Update
|
-- << Update
|
||||||
update company
|
update cm
|
||||||
set clid = @clid
|
set code = @code
|
||||||
, code = @code
|
, name = @name
|
||||||
, title = @title
|
|
||||||
, is_active = @is_active
|
, is_active = @is_active
|
||||||
, notes = @notes
|
, notes = @notes
|
||||||
, tmpl = @tmpl
|
, tmpl = @tmpl
|
||||||
@@ -41,7 +40,7 @@ where id = @id
|
|||||||
|
|
||||||
-- << Delete
|
-- << Delete
|
||||||
delete
|
delete
|
||||||
from company
|
from cm
|
||||||
where id = $1
|
where id = $1
|
||||||
-- Delete >>
|
-- Delete >>
|
||||||
|
|
||||||
@@ -49,12 +48,12 @@ where id = $1
|
|||||||
select clid
|
select clid
|
||||||
, id
|
, id
|
||||||
, code
|
, code
|
||||||
, title
|
, name
|
||||||
, is_active
|
, is_active
|
||||||
, notes
|
, notes
|
||||||
, tmpl
|
, tmpl
|
||||||
|
|
||||||
from company {{.Where}}
|
from cm {{.Where}}
|
||||||
{{.OrderBy}}
|
{{.OrderBy}}
|
||||||
{{.Rows}}
|
{{.Rows}}
|
||||||
-- List >>
|
-- List >>
|
||||||
Binary file not shown.
@@ -5,7 +5,7 @@ import (
|
|||||||
"git.makki.io/makki/libgo/cmn"
|
"git.makki.io/makki/libgo/cmn"
|
||||||
"git.makki.io/makki/libgo/dbu"
|
"git.makki.io/makki/libgo/dbu"
|
||||||
"git.makki.io/makki/libgo/mhttp"
|
"git.makki.io/makki/libgo/mhttp"
|
||||||
"git.makki.io/makki/libgo/nauth"
|
"git.notitek.com.tr/common/notgo/nauth"
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
@@ -146,7 +146,7 @@ func companyList(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rp, err := dbu.NewRepoWithFile(r.Context(), "company", nil)
|
rp, err := dbu.NewRepoWithFile(r.Context(), "cm", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mhttp.InternalServerError(w, err)
|
mhttp.InternalServerError(w, err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func tmplPost(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sq := "update company set tmpl = $2 where id = $1"
|
sq := "update cm set tmpl = $2 where id = $1"
|
||||||
_, err = dbu.DB.Exec(r.Context(), sq, companyID, body)
|
_, err = dbu.DB.Exec(r.Context(), sq, companyID, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mhttp.InternalServerError(w, err)
|
mhttp.InternalServerError(w, err)
|
||||||
@@ -33,7 +33,7 @@ func tmplGet(w http.ResponseWriter, r *http.Request) {
|
|||||||
companyID := cmn.StrToInt64(chi.URLParam(r, "companyID"))
|
companyID := cmn.StrToInt64(chi.URLParam(r, "companyID"))
|
||||||
var body json.RawMessage
|
var body json.RawMessage
|
||||||
|
|
||||||
sq := "select tmpl from company where id = $1"
|
sq := "select tmpl from cm where id = $1"
|
||||||
err := dbu.DB.QueryRow(r.Context(), sq, companyID).Scan(&body)
|
err := dbu.DB.QueryRow(r.Context(), sq, companyID).Scan(&body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mhttp.InternalServerError(w, err)
|
mhttp.InternalServerError(w, err)
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package public
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.makki.io/makki/libgo/mhttp"
|
|
||||||
"git.makki.io/makki/libgo/svc"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func login(w http.ResponseWriter, r *http.Request) {
|
|
||||||
authResp, err := svc.S.Authenticate(r)
|
|
||||||
if err != nil {
|
|
||||||
mhttp.InternalServerError(w, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
clientResp := authResp.GetEndUserResponse()
|
|
||||||
mhttp.ResponseSuccess(w, clientResp)
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package public
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/go-chi/chi/v5"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Router() http.Handler {
|
|
||||||
r := chi.NewRouter()
|
|
||||||
|
|
||||||
// user authentication
|
|
||||||
r.Post("/login", login)
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bordro-esleme/api/public"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.makki.io/makki/libgo/napi"
|
"git.makki.io/makki/libgo/mhttp"
|
||||||
"git.makki.io/makki/libgo/nauth"
|
"git.notitek.com.tr/common/notgo/napi"
|
||||||
|
"git.notitek.com.tr/common/notgo/nauth"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@@ -20,6 +20,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HttpHandler(re enums.TRunEnv) http.Handler {
|
func HttpHandler(re enums.TRunEnv) http.Handler {
|
||||||
|
lookup := &mhttp.Lookup{
|
||||||
|
DoClientCheck: true,
|
||||||
|
Funcs: map[string]mhttp.LookupFunc{
|
||||||
|
"entegrator": napi.Entegrators,
|
||||||
|
|
||||||
|
"invmarket": napi.InvMarket,
|
||||||
|
|
||||||
|
"usr": napi.Usr,
|
||||||
|
"rates": napi.Currency,
|
||||||
|
},
|
||||||
|
CompanyCheckQueries: []string{"mmitem", "acchart", "ficomp"},
|
||||||
|
JwtAuth: svc.S.JWT,
|
||||||
|
}
|
||||||
|
|
||||||
mux := chi.NewRouter()
|
mux := chi.NewRouter()
|
||||||
|
|
||||||
// Gerekli middleware stack
|
// Gerekli middleware stack
|
||||||
@@ -51,17 +65,25 @@ func HttpHandler(re enums.TRunEnv) http.Handler {
|
|||||||
|
|
||||||
mux.Route("/api", func(mr chi.Router) {
|
mux.Route("/api", func(mr chi.Router) {
|
||||||
// Public Route endpoints
|
// Public Route endpoints
|
||||||
mr.Mount("/", public.Router())
|
mr.Post("/login", napi.Login)
|
||||||
//mr.Mount("/admin", admin.Router())
|
|
||||||
|
|
||||||
//protected end points
|
//protected end points
|
||||||
mr.Group(func(r chi.Router) {
|
mr.Group(func(r chi.Router) {
|
||||||
// Seek, verify and validate JWT tokens
|
// Seek, verify and validate JWT tokens
|
||||||
r.Use(jwtauth.Verifier(svc.S.JWT))
|
r.Use(jwtauth.Verify(svc.S.JWT, jwtauth.TokenFromHeader, jwtauth.TokenFromCookie, jwtauth.TokenFromQuery))
|
||||||
|
|
||||||
// Handle valid / invalid tokens.
|
// Handle valid / invalid tokens.
|
||||||
r.Use(nauth.CheckTokenValidity)
|
r.Use(nauth.CheckTokenValidity)
|
||||||
|
|
||||||
|
// Set clientID
|
||||||
|
r.Use(nauth.ClientID)
|
||||||
|
|
||||||
|
// Handle valid / invalid tokens.
|
||||||
|
r.Use(nauth.CheckTokenValidity)
|
||||||
|
|
||||||
|
// lookup
|
||||||
|
r.Method("post", "/lookup/{query}", lookup)
|
||||||
|
|
||||||
// sy routes
|
// sy routes
|
||||||
r.Get("/sy/companies", napi.CompanyList)
|
r.Get("/sy/companies", napi.CompanyList)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"git.makki.io/makki/libgo/dbu"
|
"git.makki.io/makki/libgo/dbu"
|
||||||
"git.makki.io/makki/libgo/mlog"
|
"git.makki.io/makki/libgo/mlog"
|
||||||
"git.makki.io/makki/libgo/svc"
|
"git.makki.io/makki/libgo/svc"
|
||||||
|
"git.notitek.com.tr/common/notgo/nauth"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ func main() {
|
|||||||
if svc.S.DevMode() {
|
if svc.S.DevMode() {
|
||||||
expire = time.Hour * 48
|
expire = time.Hour * 48
|
||||||
}
|
}
|
||||||
err = s.SubscribeToAuthServer(expire)
|
err = nauth.SubscribeToAuthServer(s.Ctx, expire)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mlog.Fatal(err)
|
mlog.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Company struct {
|
type Company struct {
|
||||||
Clid int64 `db:"clid" json:"-"`
|
ClID int64 `db:"clid" json:"-"`
|
||||||
ID int64 `db:"id"`
|
ID int64 `db:"id"`
|
||||||
Code string `db:"code"`
|
Code string `db:"code"`
|
||||||
Title null.String `db:"title"`
|
Name null.String `db:"name"`
|
||||||
IsActive bool `db:"is_active"`
|
IsActive bool `db:"is_active"`
|
||||||
Notes null.String `db:"notes"`
|
Notes null.String `db:"notes"`
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ func New() *Company {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DbRead(ctx context.Context, id int64) (*Company, error) {
|
func DbRead(ctx context.Context, id int64) (*Company, error) {
|
||||||
rp, err := dbu.NewRepoWithFile(ctx, "company", nil)
|
rp, err := dbu.NewRepoWithFile(ctx, "cm", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ func DbDelete(ctx context.Context, id int64, log bool, usrID *int64) error {
|
|||||||
}
|
}
|
||||||
defer tx.Rollback(ctx)
|
defer tx.Rollback(ctx)
|
||||||
|
|
||||||
rp, err := dbu.NewRepoWithFile(ctx, "company", tx)
|
rp, err := dbu.NewRepoWithFile(ctx, "cm", tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ func DbDelete(ctx context.Context, id int64, log bool, usrID *int64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return dbu.ParsedErrSuppressNoRows(err)
|
return dbu.ParsedErrSuppressNoRows(err)
|
||||||
}
|
}
|
||||||
err = dbu.DB.LogDMLTx("d", "company", oldData.ID, usrID, "", oldData, nil, tx)
|
err = dbu.DB.LogDMLTx("d", "cm", oldData.ID, usrID, "", oldData, nil, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(err.Error())
|
slog.Error(err.Error())
|
||||||
}
|
}
|
||||||
@@ -81,9 +81,9 @@ func DbDelete(ctx context.Context, id int64, log bool, usrID *int64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Company) DbCreate(ctx context.Context, clID int64, log bool, usrID *int64) error {
|
func (m *Company) DbCreate(ctx context.Context, clID int64, log bool, usrID *int64) error {
|
||||||
m.Clid = clID
|
m.ClID = clID
|
||||||
|
|
||||||
rp, err := dbu.NewRepoWithFile(ctx, "company", nil)
|
rp, err := dbu.NewRepoWithFile(ctx, "cm", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ func (m *Company) DbCreate(ctx context.Context, clID int64, log bool, usrID *int
|
|||||||
}
|
}
|
||||||
|
|
||||||
if log {
|
if log {
|
||||||
err = dbu.DB.LogDMLTx("c", "company", m.ID, usrID, "", nil, m, nil)
|
err = dbu.DB.LogDMLTx("c", "cm", m.ID, usrID, "", nil, m, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(err.Error())
|
slog.Error(err.Error())
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ func (m *Company) DbUpdate(ctx context.Context, log bool, usrID *int64) error {
|
|||||||
}
|
}
|
||||||
defer tx.Rollback(ctx)
|
defer tx.Rollback(ctx)
|
||||||
|
|
||||||
rp, err := dbu.NewRepoWithFile(ctx, "company", tx)
|
rp, err := dbu.NewRepoWithFile(ctx, "cm", tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ func (m *Company) DbUpdate(ctx context.Context, log bool, usrID *int64) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = dbu.DB.LogDMLTx("u", "company", oldData.ID, usrID, "", oldData, m, tx)
|
err = dbu.DB.LogDMLTx("u", "cm", oldData.ID, usrID, "", oldData, m, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error(err.Error())
|
slog.Error(err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"pinia": "^2.0.11",
|
"pinia": "^2.0.11",
|
||||||
"quasar": "^2.8.0",
|
"quasar": "^2.8.0",
|
||||||
|
"reconnecting-websocket": "^4.4.0",
|
||||||
"vue": "^3.4.18",
|
"vue": "^3.4.18",
|
||||||
"vue-i18n": "^9.9.0",
|
"vue-i18n": "^9.9.0",
|
||||||
"vue-router": "^4.0.12",
|
"vue-router": "^4.0.12",
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ module.exports = configure(function (ctx) {
|
|||||||
// analyze: true,
|
// analyze: true,
|
||||||
env: {
|
env: {
|
||||||
showLangSelect: false,
|
showLangSelect: false,
|
||||||
|
wsActive: false,
|
||||||
apiAddr: (() => {
|
apiAddr: (() => {
|
||||||
if (process.env.CUSTOM_API) {
|
if (process.env.CUSTOM_API) {
|
||||||
return process.env.CUSTOM_API
|
return process.env.CUSTOM_API
|
||||||
@@ -150,6 +151,8 @@ module.exports = configure(function (ctx) {
|
|||||||
'Loading',
|
'Loading',
|
||||||
'Dialog',
|
'Dialog',
|
||||||
'Meta',
|
'Meta',
|
||||||
|
'LocalStorage',
|
||||||
|
'SessionStorage'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
import { EventBus } from 'quasar'
|
import { EventBus } from 'quasar'
|
||||||
import { boot } from 'quasar/wrappers'
|
import { boot } from 'quasar/wrappers'
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
const bus = new EventBus()
|
||||||
const bus = new EventBus()
|
|
||||||
|
|
||||||
|
export default boot(({ app }) => {
|
||||||
// for Options API
|
// for Options API
|
||||||
app.config.globalProperties.$bus = bus
|
app.config.globalProperties.$bus = bus
|
||||||
|
|
||||||
// for Composition API
|
// for Composition API
|
||||||
app.provide('bus', bus)
|
app.provide('bus', bus)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export { bus }
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const prjI18n = {
|
|||||||
app: 'Uygulamalar'
|
app: 'Uygulamalar'
|
||||||
},
|
},
|
||||||
Company: {
|
Company: {
|
||||||
|
ID: 'Şirket ID',
|
||||||
Code: 'Şirket Kod',
|
Code: 'Şirket Kod',
|
||||||
Title: 'Şirket Ad',
|
Title: 'Şirket Ad',
|
||||||
IsActive: 'Kullanımda',
|
IsActive: 'Kullanımda',
|
||||||
|
|||||||
@@ -5,14 +5,12 @@ const t = i18n.global.t
|
|||||||
class Company extends Model {
|
class Company extends Model {
|
||||||
ID = null
|
ID = null
|
||||||
Code = ''
|
Code = ''
|
||||||
Title = ''
|
Name = ''
|
||||||
IsActive = true
|
IsActive = true
|
||||||
Notes = ''
|
Notes = ''
|
||||||
|
|
||||||
|
|
||||||
Tmpl = ''
|
Tmpl = ''
|
||||||
|
|
||||||
|
|
||||||
_colOptions = {
|
_colOptions = {
|
||||||
ID: {
|
ID: {
|
||||||
label: t('Company.ID'),
|
label: t('Company.ID'),
|
||||||
@@ -40,7 +38,7 @@ class Company extends Model {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Title: {
|
Name: {
|
||||||
label: t('Company.Title'),
|
label: t('Company.Title'),
|
||||||
visible: true,
|
visible: true,
|
||||||
dataType: 'text', //numeric, text, date, bool, datetime, time, inet
|
dataType: 'text', //numeric, text, date, bool, datetime, time, inet
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<q-input class="col-xs-12 col-sm-6"
|
<q-input class="col-xs-12 col-sm-6"
|
||||||
v-model="model.Title"
|
v-model="model.Name"
|
||||||
:label="t('Company.Title')"
|
:label="t('Company.Title')"
|
||||||
bottom-slots
|
bottom-slots
|
||||||
:rules="[]"
|
:rules="[]"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
:label="t('selectCompany')"
|
:label="t('selectCompany')"
|
||||||
:options="ld.companies"
|
:options="ld.companies"
|
||||||
option-value="ID"
|
option-value="ID"
|
||||||
option-label="Title"
|
option-label="Name"
|
||||||
dense
|
dense
|
||||||
options-dense
|
options-dense
|
||||||
outlined
|
outlined
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
:label="t('selectCompany')"
|
:label="t('selectCompany')"
|
||||||
:options="ld.companies"
|
:options="ld.companies"
|
||||||
option-value="ID"
|
option-value="ID"
|
||||||
option-label="Title"
|
option-label="Name"
|
||||||
dense
|
dense
|
||||||
options-dense
|
options-dense
|
||||||
outlined
|
outlined
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { LocalStorage } from 'quasar'
|
|||||||
import { api } from 'boot/axios'
|
import { api } from 'boot/axios'
|
||||||
import { jwtDecode } from "jwt-decode"
|
import { jwtDecode } from "jwt-decode"
|
||||||
import Router from 'src/router/index'
|
import Router from 'src/router/index'
|
||||||
|
import {bus} from 'boot/bus'
|
||||||
|
|
||||||
export const sessionName = 'bresSession'
|
export const sessionName = 'bresSession'
|
||||||
|
|
||||||
@@ -10,17 +11,26 @@ const defaultState = {
|
|||||||
LoggedIn: false,
|
LoggedIn: false,
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
Token: '',
|
Token: '',
|
||||||
UsrKSUID: '',
|
UsrKsuid: '',
|
||||||
UsrEmail: '',
|
UsrEmail: '',
|
||||||
UsrFullname: '',
|
UsrFullName: '',
|
||||||
Username: '',
|
Username: '',
|
||||||
|
|
||||||
ClientKSUID: '',
|
ClientKsuid: '',
|
||||||
ClientCode: '',
|
ClientCode: '',
|
||||||
LicenseCode: '',
|
LicenseCode: '',
|
||||||
PkgConf: {}
|
PkgConf: {},
|
||||||
|
|
||||||
|
companyID: null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bus.on('companySelect', (companyID) => {
|
||||||
|
const store = useLoginStore()
|
||||||
|
//store.companyID = companyID
|
||||||
|
store.setCompanyID(companyID)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
export const useLoginStore = defineStore('login', {
|
export const useLoginStore = defineStore('login', {
|
||||||
state: () => {
|
state: () => {
|
||||||
return JSON.parse(JSON.stringify(defaultState))
|
return JSON.parse(JSON.stringify(defaultState))
|
||||||
@@ -28,6 +38,11 @@ export const useLoginStore = defineStore('login', {
|
|||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
setCompanyID(companyID) {
|
||||||
|
this.companyID = companyID
|
||||||
|
this.save()
|
||||||
|
},
|
||||||
|
|
||||||
login (payload) {
|
login (payload) {
|
||||||
// kaldıysa önceki session'ı uçuralım
|
// kaldıysa önceki session'ı uçuralım
|
||||||
LocalStorage.remove(sessionName)
|
LocalStorage.remove(sessionName)
|
||||||
@@ -58,6 +73,14 @@ export const useLoginStore = defineStore('login', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateProfile (payload) {
|
||||||
|
this.UsrFullName = payload.fullname
|
||||||
|
this.UsrEmail = payload.email
|
||||||
|
this.Username = payload.username
|
||||||
|
|
||||||
|
this.save()
|
||||||
|
},
|
||||||
|
|
||||||
updateState (payload) {
|
updateState (payload) {
|
||||||
Object.assign(this, payload)
|
Object.assign(this, payload)
|
||||||
api.defaults.headers.common['Authorization'] = `Bearer ${payload.Token}`
|
api.defaults.headers.common['Authorization'] = `Bearer ${payload.Token}`
|
||||||
@@ -76,9 +99,17 @@ export const useLoginStore = defineStore('login', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
save () {
|
||||||
|
const pl = {}
|
||||||
|
Object.keys(defaultState).forEach((key) => {
|
||||||
|
pl[key] = this[key]
|
||||||
|
})
|
||||||
|
LocalStorage.set(sessionName, pl)
|
||||||
|
},
|
||||||
|
|
||||||
IsLoggedIn () {
|
IsLoggedIn () {
|
||||||
return this.LoggedIn
|
return this.LoggedIn
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -2593,6 +2593,11 @@ readdirp@~3.6.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
picomatch "^2.2.1"
|
picomatch "^2.2.1"
|
||||||
|
|
||||||
|
reconnecting-websocket@^4.4.0:
|
||||||
|
version "4.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/reconnecting-websocket/-/reconnecting-websocket-4.4.0.tgz#3b0e5b96ef119e78a03135865b8bb0af1b948783"
|
||||||
|
integrity sha512-D2E33ceRPga0NvTDhJmphEgJ7FUYF0v4lr1ki0csq06OdlxKfugGzN0dSkxM/NfqCxYELK4KcaTOUOjTV6Dcng==
|
||||||
|
|
||||||
register-service-worker@^1.7.2:
|
register-service-worker@^1.7.2:
|
||||||
version "1.7.2"
|
version "1.7.2"
|
||||||
resolved "https://registry.yarnpkg.com/register-service-worker/-/register-service-worker-1.7.2.tgz#6516983e1ef790a98c4225af1216bc80941a4bd2"
|
resolved "https://registry.yarnpkg.com/register-service-worker/-/register-service-worker-1.7.2.tgz#6516983e1ef790a98c4225af1216bc80941a4bd2"
|
||||||
|
|||||||
Reference in New Issue
Block a user