20 lines
552 B
Svelte
20 lines
552 B
Svelte
|
<script>
|
||
|
import Provider from "./Provider.svelte"
|
||
|
import { authStore } from "../store"
|
||
|
import { ActionTypes, TableNames } from "../constants"
|
||
|
|
||
|
// Register this as a refreshable datasource so that user changes cause
|
||
|
// the user object to be refreshed
|
||
|
$: actions = [
|
||
|
{
|
||
|
type: ActionTypes.RefreshDatasource,
|
||
|
callback: () => authStore.actions.fetchUser(),
|
||
|
metadata: { dataSource: { type: "table", tableId: TableNames.USERS } },
|
||
|
},
|
||
|
]
|
||
|
</script>
|
||
|
|
||
|
<Provider key="user" data={$authStore} {actions}>
|
||
|
<slot />
|
||
|
</Provider>
|