mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 01:55:34 -05:00
aa480a2663
[web] migrate from window attributes to getMeta GitOrigin-RevId: 3dcf1ab6b01155e5e4abeb3e78d0fa9053e055bc
49 lines
1.2 KiB
JavaScript
49 lines
1.2 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'
|
|
|
|
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,
|
|
}
|