MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / validateAndSubmit

Function validateAndSubmit

packages/ui/src/views/auth/ssoConfig.jsx:192–234  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190 }
191
192 const validateAndSubmit = async () => {
193 const validationErrors = validateFields()
194 if (validationErrors.length > 0) {
195 setAuthErrors(validationErrors)
196 return
197 }
198 setLoading(true)
199 try {
200 const updateResponse = await loginMethodApi.updateLoginMethods(constructRequestBody())
201 setAuthErrors([])
202 setLoading(false)
203 if (updateResponse.data) {
204 enqueueSnackbar({
205 message: 'SSO Configuration Updated!',
206 options: {
207 key: new Date().getTime() + Math.random(),
208 variant: 'success',
209 action: (key) => (
210 <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
211 <IconX />
212 </Button>
213 )
214 }
215 })
216 }
217 } catch (error) {
218 setLoading(false)
219 setAuthErrors([typeof error.response.data === 'object' ? error.response.data.message : error.response.data])
220 enqueueSnackbar({
221 message: `Failed to update SSO Configuration.`,
222 options: {
223 key: new Date().getTime() + Math.random(),
224 variant: 'error',
225 persist: true,
226 action: (key) => (
227 <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
228 <IconX />
229 </Button>
230 )
231 }
232 })
233 }
234 }
235
236 const validateAndTest = async (providerName) => {
237 let validationErrors = []

Callers 1

SSOConfigPageFunction · 0.70

Calls 5

enqueueSnackbarFunction · 0.90
closeSnackbarFunction · 0.90
validateFieldsFunction · 0.85
constructRequestBodyFunction · 0.85
getTimeMethod · 0.45

Tested by

no test coverage detected