File tree 2 files changed +11
-2
lines changed
pages/TemplateSettingsPage 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ import * as Types from "./types"
4
4
import { DeploymentConfig } from "./types"
5
5
import * as TypesGen from "./typesGenerated"
6
6
7
+ // Adds 304 for the default axios validateStatus function
8
+ // https://github.com/axios/axios#handling-errors
9
+ // Check status here https://httpstatusdogs.com/
10
+ axios . defaults . validateStatus = ( status ) => {
11
+ return ( status >= 200 && status < 300 ) || status === 304
12
+ }
13
+
7
14
export const hardCodedCSRFCookie = ( ) : string => {
8
15
// This is a hard coded CSRF token/cookie pair for local development.
9
16
// In prod, the GoLang webserver generates a random cookie with a new token for
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ export const TemplateSettingsPage: FC = () => {
18
18
context : { templateName, organizationId } ,
19
19
actions : {
20
20
onSave : ( _ , { data } ) => {
21
- // Use the data.name because the template name can be changed
22
- navigate ( `/templates/${ data . name } ` )
21
+ // Use the data.name because the template name can be changed. Since the
22
+ // API can return 304 if the template name is not changed, we use the
23
+ // templateName from the URL as default.
24
+ navigate ( `/templates/${ data . name ?? templateName } ` )
23
25
} ,
24
26
} ,
25
27
} )
You can’t perform that action at this time.
0 commit comments