Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Multinet Components

This repo bundles re-useable multinet components. So far we support:

- LoginMenu.vue

The components can be used in your application.

## Installation

```
yarn add multinet-components
```

Inside your vue components:
```
<script setup>
import { LoginMenu } from 'multinet-components';
</script>

<template>
<login-menu
:user-info="user"
:oauth-client="oauth"
:logout="logout"
:fetch-user-info="fetchUserInfo"
/>
</template>

```
12 changes: 6 additions & 6 deletions src/components/LoginMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
</template>

<script setup lang="ts">
import { computed, ref, watchEffect, watch } from 'vue';
import { Store } from '../types';
import { computed, ref, watchEffect } from 'vue';
import OAuthClient from '@girder/oauth-client';
import { UserSpec } from 'multinet';

const props = defineProps<{
store: Store;
oauthClient: OAuthClient;
userInfo: UserSpec | null;
oauthClient: OAuthClient;
logout: () => Promise<void>;
fetchUserInfo: () => Promise<void>;
}>();

const menu = ref(false);
Expand All @@ -86,7 +86,7 @@ watchEffect(() => {

async function logout() {
// Perform the logout action,
await props.store.dispatch.logout();
await props.logout();

// Redirect the user to the home page.
// This is to prevent the logged-out user from continuing to look at, e.g.,
Expand All @@ -99,7 +99,7 @@ function login() {
}

// Get user info on created
props.store.dispatch.fetchUserInfo();
props.fetchUserInfo();
</script>

<style scoped>
Expand Down
11 changes: 0 additions & 11 deletions src/types.ts

This file was deleted.