@goweekdays/layer-common 1.4.0 → 1.4.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @goweekdays/layer-common
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 2baee76: Update role and permission components for dynamic app context
8
+
9
+ ## 1.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 273fab2: Enhance member fetching and UI improvements
14
+
15
+ ## 1.4.1
16
+
17
+ ### Patch Changes
18
+
19
+ - b7afd94: Improve organization requirement page UX and messaging
20
+
3
21
  ## 1.4.0
4
22
 
5
23
  ### Minor Changes
@@ -26,6 +26,9 @@
26
26
  <template #append>
27
27
  <slot name="append"></slot>
28
28
  </template>
29
+ <template #prepend>
30
+ <slot name="prepend"></slot>
31
+ </template>
29
32
  </v-navigation-drawer>
30
33
  </template>
31
34
 
@@ -268,12 +268,15 @@ const {
268
268
  status: permissionsReqStatus,
269
269
  refresh: refreshPermissions,
270
270
  } = await useLazyAsyncData(
271
- `role-form-get-all-permission-${localProps.app}`,
271
+ `role-form-get-all-permission-${role.value.app}`,
272
272
  () =>
273
273
  getAllPerm({
274
- app: localProps.app,
274
+ app: role.value.app,
275
275
  limit: 200,
276
- })
276
+ }),
277
+ {
278
+ watch: [() => role.value.app],
279
+ }
277
280
  );
278
281
 
279
282
  const loadingPermissions = computed(
@@ -188,7 +188,7 @@ function setRole({
188
188
  JSON.parse(
189
189
  JSON.stringify({
190
190
  ...data,
191
- app: mode === "admin" ? props.app : data.app,
191
+ app: mode === "admin" || mode === "add" ? props.app : data.app,
192
192
  })
193
193
  )
194
194
  );
@@ -221,16 +221,15 @@ const {
221
221
  refresh: getRoles,
222
222
  status: getRoleReqStatus,
223
223
  } = useLazyAsyncData(
224
- "roles-permissions-get-all",
224
+ `roles-permissions-get-all-by-${props.app}-${props.org}-page-${page.value}`,
225
225
  () =>
226
226
  _getRoles({
227
227
  page: page.value,
228
- search: headerSearch.value,
229
228
  org: props.org,
230
229
  app: isOrg.value ? "" : props.app,
231
230
  }),
232
231
  {
233
- watch: [page, headerSearch],
232
+ watch: [page],
234
233
  }
235
234
  );
236
235
 
@@ -25,7 +25,7 @@
25
25
 
26
26
  <v-card width="300px" rounded="lg" class="pa-4">
27
27
  <span class="text-subtitle-2 font-weight-bold">
28
- Switch {{ prop.title }} context
28
+ {{ prop.title }}
29
29
  </span>
30
30
  <v-text-field
31
31
  v-model="search"
@@ -65,8 +65,7 @@
65
65
  const prop = defineProps({
66
66
  title: {
67
67
  type: String,
68
- required: true,
69
- default: "app",
68
+ default: "Switch Context",
70
69
  },
71
70
  items: {
72
71
  type: Array as PropType<Array<Record<string, any>>>,
@@ -48,7 +48,7 @@ export default function useLocalAuth() {
48
48
  }
49
49
 
50
50
  function verify(id: string) {
51
- return $fetch<TKeyValuePair>(`/api/auth/verify/${id}`, {
51
+ return $fetch<Record<string, any>>(`/api/auth/verify/${id}`, {
52
52
  method: "GET",
53
53
  });
54
54
  }
@@ -33,6 +33,22 @@ export default function useMember() {
33
33
  });
34
34
  }
35
35
 
36
+ function getAllByAppUser({
37
+ app = "",
38
+ user = "",
39
+ limit = 10,
40
+ page = 1,
41
+ search = "",
42
+ } = {}) {
43
+ return $fetch<Record<string, any>>(
44
+ `/api/members/orgs/app/${app}/user/${user}`,
45
+ {
46
+ method: "GET",
47
+ query: { page, limit, search },
48
+ }
49
+ );
50
+ }
51
+
36
52
  async function getAll({
37
53
  page = 1,
38
54
  search = "",
@@ -104,5 +120,6 @@ export default function useMember() {
104
120
  updateRoleById,
105
121
  updateStatusById,
106
122
  deleteById,
123
+ getAllByAppUser,
107
124
  };
108
125
  }
package/middleware/org.ts CHANGED
@@ -8,6 +8,6 @@ export default defineNuxtRouteMiddleware((to) => {
8
8
  const org = (to.params.org as string) ?? "";
9
9
 
10
10
  if (org && !hexSchema.safeParse(org).success) {
11
- return navigateTo({ name: "require-organization" }, { replace: true });
11
+ return navigateTo({ name: "require-organization" });
12
12
  }
13
13
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@goweekdays/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.4.0",
5
+ "version": "1.4.3",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
package/pages/index.vue CHANGED
@@ -64,7 +64,7 @@ const isPartnerApp = computed(() =>
64
64
  [
65
65
  "org",
66
66
  "marketplace",
67
- "services",
67
+ "service",
68
68
  "stay",
69
69
  "ride",
70
70
  "eat",
package/pages/login.vue CHANGED
@@ -158,7 +158,10 @@ async function submit({ email = "", password = "" } = {}) {
158
158
  message.value = "An unexpected error occurred. Please try again.";
159
159
  }
160
160
 
161
- if (error.response.status === 404) {
161
+ if (
162
+ error.response.status === 404 &&
163
+ error.response.url.includes("/api/members/app")
164
+ ) {
162
165
  navigateTo({ name: "index" });
163
166
  }
164
167
  } finally {
@@ -7,21 +7,45 @@
7
7
  </v-col>
8
8
 
9
9
  <span class="text-subtitle-2">
10
- You must have an organization to access this page.
10
+ You must be part of an organization to access this app. Please contact
11
+ your organization administrator or create a new organization.
11
12
  </span>
12
13
 
13
14
  <v-col cols="12" class="mt-6">
14
15
  <v-row no-gutters justify="center">
15
- <v-btn
16
- size="large"
17
- class="text-none"
18
- variant="flat"
19
- color="black"
20
- rounded
21
- @click="createOrg()"
22
- >
23
- Create Organization
24
- </v-btn>
16
+ <v-col cols="2">
17
+ <v-btn
18
+ block
19
+ size="large"
20
+ class="text-none"
21
+ variant="flat"
22
+ color="black"
23
+ rounded
24
+ @click="createOrg()"
25
+ >
26
+ Create Organization
27
+ </v-btn>
28
+ </v-col>
29
+ </v-row>
30
+ </v-col>
31
+
32
+ <v-col cols="12" class="text-center font-weight-bold my-2"> or </v-col>
33
+
34
+ <v-col cols="12">
35
+ <v-row no-gutters justify="center">
36
+ <v-col cols="2">
37
+ <v-btn
38
+ block
39
+ size="large"
40
+ class="text-none"
41
+ variant="flat"
42
+ color="black"
43
+ rounded
44
+ :to="{ name: 'index' }"
45
+ >
46
+ Return to landing page
47
+ </v-btn>
48
+ </v-col>
25
49
  </v-row>
26
50
  </v-col>
27
51
  </v-row>
@@ -34,7 +58,7 @@ definePageMeta({
34
58
 
35
59
  function createOrg() {
36
60
  const { APP, APP_ORG } = useRuntimeConfig().public;
37
- if (APP === "organization") {
61
+ if (APP === "org") {
38
62
  navigateTo({ name: "organizations-create" });
39
63
  } else {
40
64
  navigateTo(`${APP_ORG}/organizations/create`, { external: true });
@@ -139,7 +139,9 @@ const loading = ref(false);
139
139
 
140
140
  async function validate() {
141
141
  try {
142
- await verify(id);
142
+ const result = await verify(id);
143
+
144
+ type.value = result.type;
143
145
 
144
146
  validInvitation.value = true;
145
147
  message.value = "";