Skip to content

Commit

Permalink
Merge pull request #4 from multinet-app/not-whole-store
Browse files Browse the repository at this point in the history
Don't require the whole store in the LoginMenu.vue component
  • Loading branch information
JackWilb authored Dec 17, 2022
2 parents cce795a + 8472f00 commit 275bd38
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
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.

0 comments on commit 275bd38

Please sign in to comment.