viewlogic 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -387,7 +387,12 @@ var AuthManager = class {
387
387
  }
388
388
  if (typeof this.config.checkAuthFunction === "function") {
389
389
  try {
390
- const isAuthenticated2 = await this.config.checkAuthFunction(routeName);
390
+ const route = {
391
+ name: routeName,
392
+ $api: this.router.routeLoader.apiHandler.bindToComponent({}),
393
+ $state: this.router.stateHandler
394
+ };
395
+ const isAuthenticated2 = await this.config.checkAuthFunction(route);
391
396
  return {
392
397
  allowed: isAuthenticated2,
393
398
  reason: isAuthenticated2 ? "custom_auth_success" : "custom_auth_failed",
@@ -1247,9 +1252,9 @@ var FormHandler = class {
1247
1252
  const form = event.target;
1248
1253
  let action = form.getAttribute("action");
1249
1254
  const method = form.getAttribute("method") || "POST";
1250
- const successHandler = form.getAttribute("data-success-handler");
1251
- const errorHandler = form.getAttribute("data-error-handler");
1252
- const loadingHandler = form.getAttribute("data-loading-handler");
1255
+ const successHandler = form.getAttribute("data-success");
1256
+ const errorHandler = form.getAttribute("data-error");
1257
+ const loadingHandler = form.getAttribute("data-loading");
1253
1258
  const redirectTo = form.getAttribute("data-redirect");
1254
1259
  action = this.processActionParams(action, component);
1255
1260
  if (!this.validateForm(form, component)) {
@@ -2036,6 +2041,7 @@ ${template}`;
2036
2041
  ...originalData,
2037
2042
  currentRoute: routeName,
2038
2043
  $query: router.queryManager?.getQueryParams() || {},
2044
+ $params: router.queryManager?.getRouteParams() || {},
2039
2045
  $lang: (() => {
2040
2046
  try {
2041
2047
  return router.i18nManager?.getCurrentLanguage() || router.config.i18nDefaultLanguage || router.config.defaultLanguage || "ko";
@@ -2057,11 +2063,12 @@ ${template}`;
2057
2063
  },
2058
2064
  async mounted() {
2059
2065
  this.$api = router.routeLoader.apiHandler.bindToComponent(this);
2066
+ this.$state = router.stateHandler;
2060
2067
  if (script.mounted) {
2061
2068
  await script.mounted.call(this);
2062
2069
  }
2063
2070
  if (script.dataURL) {
2064
- await this.$fetchData();
2071
+ await this.fetchData();
2065
2072
  }
2066
2073
  await this.$nextTick();
2067
2074
  router.routeLoader.formHandler.bindAutoForms(this);
@@ -2083,29 +2090,22 @@ ${template}`;
2083
2090
  return key;
2084
2091
  }
2085
2092
  },
2086
- // 인증 관련
2087
- $isAuthenticated: () => router.authManager?.isAuthenticated() || false,
2088
- $logout: () => router.authManager ? router.navigateTo(router.authManager.logout()) : null,
2089
- $loginSuccess: (target) => router.authManager ? router.navigateTo(router.authManager.loginSuccess(target)) : null,
2090
- $checkAuth: (route) => router.authManager ? router.authManager.checkAuthentication(route) : Promise.resolve({ allowed: true, reason: "auth_disabled" }),
2091
- $getToken: () => router.authManager?.getAccessToken() || null,
2092
- $setToken: (token, options) => router.authManager?.setAccessToken(token, options) || false,
2093
- $removeToken: (storage) => router.authManager?.removeAccessToken(storage) || null,
2094
- $getAuthCookie: () => router.authManager?.getAuthCookie() || null,
2095
- $getCookie: (name) => router.authManager?.getCookieValue(name) || null,
2096
- // 상태 관리
2097
- $state: {
2098
- get: (key, defaultValue) => router.stateHandler?.get(key, defaultValue),
2099
- set: (key, value) => router.stateHandler?.set(key, value),
2100
- has: (key) => router.stateHandler?.has(key) || false,
2101
- delete: (key) => router.stateHandler?.delete(key) || false,
2102
- update: (updates) => router.stateHandler?.update(updates),
2103
- watch: (key, callback) => router.stateHandler?.watch(key, callback),
2104
- unwatch: (key, callback) => router.stateHandler?.unwatch(key, callback),
2105
- getAll: () => router.stateHandler?.getAll() || {}
2093
+ // 인증 관련 (핵심 4개 메소드만)
2094
+ isAuth: () => router.authManager?.isAuthenticated() || false,
2095
+ logout: () => router.authManager ? router.navigateTo(router.authManager.logout()) : null,
2096
+ getToken: () => router.authManager?.getAccessToken() || null,
2097
+ setToken: (token, options) => router.authManager?.setAccessToken(token, options) || false,
2098
+ // i18n 언어 관리
2099
+ getLanguage: () => router.i18nManager?.getCurrentLanguage() || router.config.defaultLanguage || "ko",
2100
+ setLanguage: (lang) => router.i18nManager?.setLanguage(lang),
2101
+ // 로깅 에러 처리
2102
+ log: (level, ...args) => {
2103
+ if (router.errorHandler) {
2104
+ router.errorHandler.log(level, `[${routeName}]`, ...args);
2105
+ }
2106
2106
  },
2107
2107
  // 데이터 fetch (ApiHandler 래퍼)
2108
- async $fetchData(dataConfig = null) {
2108
+ async fetchData(dataConfig = null) {
2109
2109
  const configToUse = dataConfig || script.dataURL;
2110
2110
  if (!configToUse) return null;
2111
2111
  this.$dataLoading = true;