mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): Don't handle 304 as error (#6655)
This commit is contained in:
@@ -4,6 +4,13 @@ import * as Types from "./types"
|
||||
import { DeploymentConfig } from "./types"
|
||||
import * as TypesGen from "./typesGenerated"
|
||||
|
||||
// Adds 304 for the default axios validateStatus function
|
||||
// https://github.com/axios/axios#handling-errors
|
||||
// Check status here https://httpstatusdogs.com/
|
||||
axios.defaults.validateStatus = (status) => {
|
||||
return (status >= 200 && status < 300) || status === 304
|
||||
}
|
||||
|
||||
export const hardCodedCSRFCookie = (): string => {
|
||||
// This is a hard coded CSRF token/cookie pair for local development.
|
||||
// In prod, the GoLang webserver generates a random cookie with a new token for
|
||||
|
||||
@@ -18,8 +18,10 @@ export const TemplateSettingsPage: FC = () => {
|
||||
context: { templateName, organizationId },
|
||||
actions: {
|
||||
onSave: (_, { data }) => {
|
||||
// Use the data.name because the template name can be changed
|
||||
navigate(`/templates/${data.name}`)
|
||||
// Use the data.name because the template name can be changed. Since the
|
||||
// API can return 304 if the template name is not changed, we use the
|
||||
// templateName from the URL as default.
|
||||
navigate(`/templates/${data.name ?? templateName}`)
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user