---
title: "useWorkspace"
description: "useWorkspace, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-workspace"
---
# useWorkspace

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### Workspace

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

A workspace.

#### Extended by

- [`ActiveWorkspace`](#activeworkspace)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="slug">
        
      </a>
      
       <code>
        slug
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="logo">
        
      </a>
      
       <code>
        logo?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createdat">
        
      </a>
      
       <code>
        createdAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### WorkspaceMember

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

A workspace member row.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-1">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid-1">
        
      </a>
      
       <code>
        workspaceId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="userid">
        
      </a>
      
       <code>
        userId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role">
        
      </a>
      
       <code>
        role
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createdat-1">
        
      </a>
      
       <code>
        createdAt?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="user">
        
      </a>
      
       <code>
        user?
      </code>
    </td>
    
    <td>
      { <code>
        id?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        email?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        name?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        image?
      </code>
      
      : <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        user.id?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        user.email?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        user.name?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        user.image?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ActiveWorkspace

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

The active workspace with its members and invitations.

#### Extends

- [`Workspace`](#workspace)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-2">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      .<a href="#id">
        <code>
          id
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="name-1">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      .<a href="#name">
        <code>
          name
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="slug-1">
        
      </a>
      
       <code>
        slug
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      .<a href="#slug">
        <code>
          slug
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="logo-1">
        
      </a>
      
       <code>
        logo?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      .<a href="#logo">
        <code>
          logo
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="createdat-2">
        
      </a>
      
       <code>
        createdAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      <a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      .<a href="#createdat">
        <code>
          createdAt
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata-1">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      .<a href="#metadata">
        <code>
          metadata
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="members">
        
      </a>
      
       <code>
        members
      </code>
    </td>
    
    <td>
      readonly <a href="#workspacemember">
        <code>
          WorkspaceMember
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invitations">
        
      </a>
      
       <code>
        invitations
      </code>
    </td>
    
    <td>
      readonly <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### WorkspaceInvitation

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

An invitation to a workspace.

#### Extended by

- [`InvitationDetails`](#invitationdetails)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-3">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role-1">
        
      </a>
      
       <code>
        role?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid-2">
        
      </a>
      
       <code>
        workspaceId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="inviterid">
        
      </a>
      
       <code>
        inviterId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="expiresat">
        
      </a>
      
       <code>
        expiresAt
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### InvitationDetails

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

A single invitation with its workspace/inviter context (accept-page data).

#### Extends

- [`WorkspaceInvitation`](#workspaceinvitation)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id-4">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#id-3">
        <code>
          id
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="email-1">
        
      </a>
      
       <code>
        email
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#email">
        <code>
          email
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role-2">
        
      </a>
      
       <code>
        role?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#role-1">
        <code>
          role
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="status-1">
        
      </a>
      
       <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#status">
        <code>
          status
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid-3">
        
      </a>
      
       <code>
        workspaceId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#workspaceid-2">
        <code>
          workspaceId
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="inviterid-1">
        
      </a>
      
       <code>
        inviterId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#inviterid">
        <code>
          inviterId
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="expiresat-1">
        
      </a>
      
       <code>
        expiresAt
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      <a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      .<a href="#expiresat">
        <code>
          expiresAt
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspacename-1">
        
      </a>
      
       <code>
        workspaceName
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceslug-1">
        
      </a>
      
       <code>
        workspaceSlug
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="inviteremail">
        
      </a>
      
       <code>
        inviterEmail
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseWorkspaceReturn

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="workspaces">
        
      </a>
      
       <code>
        workspaces
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      Every workspace the user belongs to.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="current">
        
      </a>
      
       <code>
        current
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#activeworkspace">
        <code>
          ActiveWorkspace
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The active workspace (with members + invitations), <code>
        null
      </code>
      
       when none.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="member">
        
      </a>
      
       <code>
        member
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#workspacemember">
        <code>
          WorkspaceMember
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The user's membership in the active workspace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role-3">
        
      </a>
      
       <code>
        role
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The user's role <em>
        within the active workspace
      </em>
      
       (owner/admin/member or custom).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="members-1">
        
      </a>
      
       <code>
        members
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#workspacemember">
        <code>
          WorkspaceMember
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      Members of the active workspace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invitations-1">
        
      </a>
      
       <code>
        invitations
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      The active workspace's pending invitations, live.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while workspace state is loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ispending">
        
      </a>
      
       <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while an action runs.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the last action failed, else why the workspace state could not be read, else <code>
        null
      </code>
      
      . An action clears its own failure when the next one starts, and signing out clears it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="setactive">
        
      </a>
      
       <code>
        setActive
      </code>
    </td>
    
    <td>
      (<code>
        workspaceId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Switch the active workspace. Refreshes the backend token (the active workspace rides on its claims) and re-authenticates the live connection, so all workspace-scoped queries re-run against the new workspace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="create">
        
      </a>
      
       <code>
        create
      </code>
    </td>
    
    <td>
      (<code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#workspace">
        <code>
          Workspace
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Create a workspace (users can own several); it becomes the active one. Resolves with it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="rename">
        
      </a>
      
       <code>
        rename
      </code>
    </td>
    
    <td>
      (<code>
        name
      </code>
      
      , <code>
        workspaceId?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Rename a workspace (the active one unless <code>
        workspaceId
      </code>
      
       names another), keeping its address. Owners and admins only.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="invite">
        
      </a>
      
       <code>
        invite
      </code>
    </td>
    
    <td>
      (<code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Invite someone to the active workspace (they receive an accept-link email). Resolves with the invitation.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="leave">
        
      </a>
      
       <code>
        leave
      </code>
    </td>
    
    <td>
      (<code>
        workspaceId?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Leave a workspace (defaults to the active one). The last owner can't leave.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="updatememberrole">
        
      </a>
      
       <code>
        updateMemberRole
      </code>
    </td>
    
    <td>
      (<code>
        memberId
      </code>
      
      , <code>
        role
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Give a member of the active workspace another built-in role: <code>
        owner
      </code>
      
      , <code>
        admin
      </code>
      
       or <code>
        member
      </code>
      
       (owner and admins only).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="removemember">
        
      </a>
      
       <code>
        removeMember
      </code>
    </td>
    
    <td>
      (<code>
        memberId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Take a member out of the active workspace (owner and admins only).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="acceptinvitation">
        
      </a>
      
       <code>
        acceptInvitation
      </code>
    </td>
    
    <td>
      (<code>
        invitationId
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#workspacemember">
        <code>
          WorkspaceMember
        </code>
      </a>
      
      >
    </td>
    
    <td>
      Accept a received invitation. Refreshes the workspace claim; with <code>
        activate: true
      </code>
      
       the joined workspace also becomes the active one. Resolves with the new membership once the server accepted: a switch that fails afterwards does not undo that, and shows in <code>
        error
      </code>
      
       instead.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="declineinvitation">
        
      </a>
      
       <code>
        declineInvitation
      </code>
    </td>
    
    <td>
      (<code>
        invitationId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Decline a received invitation.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancelinvitation">
        
      </a>
      
       <code>
        cancelInvitation
      </code>
    </td>
    
    <td>
      (<code>
        invitationId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Cancel a pending invitation you (or a teammate) sent — inviter side.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getinvitation">
        
      </a>
      
       <code>
        getInvitation
      </code>
    </td>
    
    <td>
      (<code>
        invitationId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<a href="#invitationdetails">
        <code>
          InvitationDetails
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      A single invitation with workspace/inviter context (for the accept page); <code>
        null
      </code>
      
       when there is no such invitation, or it is no longer pending. Any other refusal rejects.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="listreceivedinvitations">
        
      </a>
      
       <code>
        listReceivedInvitations
      </code>
    </td>
    
    <td>
      () => <code>
        Promise
      </code>
      
      <<a href="#workspaceinvitation">
        <code>
          WorkspaceInvitation
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      Invitations the signed-in user has received (across workspaces).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts" rel="nofollow">
        src/runtime/vue/composables/use-workspace.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### ReceivedInvitation

```ts
type ReceivedInvitation = WorkspaceInvitation;
```

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

An invitation the signed-in user has received.

## Functions

### useWorkspace()

```ts
function useWorkspace(): UseWorkspaceReturn;
```

Defined in: [src/runtime/vue/composables/use-workspace.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-workspace.ts)

Workspace state and actions: the list, the switch, the members and the
full invitation flow (invite / accept / decline / cancel — the packaged
`AcceptInvitation` component and `/accept-invitation` page build on these).

The workspace state never throws: a failed read shows in `error`. Every
action resolves with its data, or rejects with an `Error` whose message is
the package's label for the refusal, in the reader's language (the auth
client's error as the `cause`, which `getBackendError` reads) and keeps the failure in `error`; a
rate-limited call carries the wait as `retryAfter`.

#### Returns

[`UseWorkspaceReturn`](#useworkspacereturn)

#### Example

```vue
<script setup lang="ts">
const { workspaces, current, setActive, error } = useWorkspace()
</script>
<template>
  <p v-if="error">{{ error.message }}</p>
  <select :value="current?.id" @change="setActive(($event.target as HTMLSelectElement).value)">
    <option v-for="workspace in workspaces" :key="workspace.id" :value="workspace.id">
      {{ workspace.name }}
    </option>
  </select>
</template>
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
