mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 20:13:46 -05:00
4a8b79080b
* [storybook] Update Storybook to version 8.3.5 * [storybook] Run storybook with `--no-open`. Fixes xdg-utils issue * [storybook] Create decorator for BS3/BS5 * [storybook] Add `bsVersionDecorator` to stories * [storybook] Fix bugs in stories * [storybook] Fixup `useMeta` type. Use `DeepPartial` * [storybook] Fix types GitOrigin-RevId: 48c0f0fefb1ab2d4863ab59051b900b1908a613c
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import useFetchMock from '../hooks/use-fetch-mock'
|
|
import PasswordSection from '../../js/features/settings/components/password-section'
|
|
import { setDefaultMeta, defaultSetupMocks } from './helpers/password'
|
|
import getMeta from '@/utils/meta'
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
|
|
|
export const Success = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <PasswordSection {...args} />
|
|
}
|
|
|
|
export const ManagedExternally = args => {
|
|
setDefaultMeta()
|
|
Object.assign(getMeta('ol-ExposedSettings'), {
|
|
isOverleaf: false,
|
|
})
|
|
window.metaAttributesCache.set('ol-isExternalAuthenticationSystemUsed', true)
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <PasswordSection {...args} />
|
|
}
|
|
|
|
export const NoExistingPassword = args => {
|
|
setDefaultMeta()
|
|
window.metaAttributesCache.set('ol-hasPassword', false)
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <PasswordSection {...args} />
|
|
}
|
|
|
|
export const Error = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock =>
|
|
fetchMock.post(/\/user\/password\/update/, {
|
|
status: 400,
|
|
body: {
|
|
message: 'Your old password is wrong',
|
|
},
|
|
})
|
|
)
|
|
|
|
return <PasswordSection {...args} />
|
|
}
|
|
|
|
export default {
|
|
title: 'Account Settings / Password',
|
|
component: PasswordSection,
|
|
argTypes: {
|
|
...bsVersionDecorator.argTypes,
|
|
},
|
|
}
|