2021-08-13 12:24:47 +02:00
|
|
|
<script>
|
|
|
|
import Provider from "./Provider.svelte"
|
2021-09-01 12:41:48 +02:00
|
|
|
import { authStore } from "stores"
|
|
|
|
import { ActionTypes, TableNames } from "constants"
|
2021-08-13 12:24:47 +02:00
|
|
|
|
|
|
|
// 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>
|