Browse Source

fix/fixed url generation

pull/3067/head
Muhammed Mustafa 2 years ago
parent
commit
45a9d50c7d
  1. 3
      packages/nc-gui-v2/components/tabs/auth/UserManagement.vue
  2. 5
      packages/nc-gui-v2/components/tabs/auth/user-management/ShareBase.vue
  3. 3
      packages/nc-gui-v2/components/tabs/auth/user-management/UsersModal.vue
  4. 4
      packages/nc-gui-v2/utils/urlUtils.ts

3
packages/nc-gui-v2/components/tabs/auth/UserManagement.vue

@ -23,6 +23,7 @@ const { $api, $e } = useNuxtApp()
const { project } = useProject()
const { copy } = useClipboard()
const { isUIAllowed } = useUIPermission()
const { dashboardUrl } = $(useDashboard())
let users = $ref<null | User[]>(null)
let selectedUser = $ref<null | User>(null)
@ -122,7 +123,7 @@ const resendInvite = async (user: User) => {
const copyInviteUrl = (user: User) => {
if (!user.invite_token) return
const getInviteUrl = (token: string) => `${location.origin}${location.pathname}#/user/authentication/signup/${token}`
const getInviteUrl = (token: string) => `${dashboardUrl}/user/authentication/signup/${token}`
copy(getInviteUrl(user.invite_token))
toast.success('Invite url copied to clipboard')

5
packages/nc-gui-v2/components/tabs/auth/user-management/ShareBase.vue

@ -1,9 +1,10 @@
<script setup lang="ts">
import { useToast } from 'vue-toastification'
import { onMounted, useClipboard, useNuxtApp, useProject } from '#imports'
import { dashboardUrl, extractSdkResponseErrorMsg } from '~/utils'
import { extractSdkResponseErrorMsg } from '~/utils'
const toast = useToast()
const { dashboardUrl } = $(useDashboard())
interface ShareBase {
uuid?: string
@ -26,7 +27,7 @@ const { project } = useProject()
const { copy } = useClipboard()
const url = $computed(() => (base && base.uuid ? `${dashboardUrl()}/nc/base/${base.uuid}` : null))
const url = $computed(() => (base && base.uuid ? `${dashboardUrl}/nc/base/${base.uuid}` : null))
const loadBase = async () => {
try {

3
packages/nc-gui-v2/components/tabs/auth/user-management/UsersModal.vue

@ -31,6 +31,7 @@ const toast = useToast()
const { project } = useProject()
const { $api, $e } = useNuxtApp()
const { copy } = useClipboard()
const { dashboardUrl } = $(useDashboard())
const usersData = $ref<Users>({ emails: undefined, role: ProjectRole.Viewer, invitationToken: undefined })
const formRef = ref()
@ -100,7 +101,7 @@ const saveUser = async () => {
}
const inviteUrl = $computed(() =>
usersData.invitationToken ? `${location.origin}/user/authentication/signup/${usersData.invitationToken}` : null,
usersData.invitationToken ? `${dashboardUrl}/user/authentication/signup/${usersData.invitationToken}` : null,
)
const copyUrl = async () => {

4
packages/nc-gui-v2/utils/urlUtils.ts

@ -17,10 +17,6 @@ export const replaceUrlsWithLink = (text: string): boolean | string => {
return found && out
}
export const dashboardUrl = () => {
return `${location.origin}`
}
// ref : https://stackoverflow.com/a/5717133
export const isValidURL = (str: string) => {
const pattern =

Loading…
Cancel
Save