feat(plugin-redirects): added new option for redirect type in the redirects collection (#7625)
You can now add a redirect type to your redirects if needed:
```ts
// Supported types
redirectTypes: ['301', '302'],
// Override the select field
redirectTypeFieldOverride: {
label: 'Redirect Type (Overridden)',
},
```
This commit is contained in:
@@ -42,6 +42,10 @@ export default buildConfigWithDefaults({
|
||||
]
|
||||
},
|
||||
},
|
||||
redirectTypes: ['301', '302'],
|
||||
redirectTypeFieldOverride: {
|
||||
label: 'Redirect Type (Overridden)',
|
||||
},
|
||||
}),
|
||||
],
|
||||
typescript: {
|
||||
|
||||
@@ -49,6 +49,7 @@ describe('@payloadcms/plugin-redirects', () => {
|
||||
value: page.id,
|
||||
},
|
||||
},
|
||||
type: '301',
|
||||
},
|
||||
})
|
||||
|
||||
@@ -66,6 +67,7 @@ describe('@payloadcms/plugin-redirects', () => {
|
||||
type: 'custom',
|
||||
url: '/test',
|
||||
},
|
||||
type: '301',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ export interface Config {
|
||||
'payload-preferences': PayloadPreference;
|
||||
'payload-migrations': PayloadMigration;
|
||||
};
|
||||
db: {
|
||||
defaultIDType: string;
|
||||
};
|
||||
globals: {};
|
||||
locale: 'en' | 'es' | 'de';
|
||||
user: User & {
|
||||
@@ -26,15 +29,20 @@ export interface Config {
|
||||
export interface UserAuthOperations {
|
||||
forgotPassword: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
login: {
|
||||
password: string;
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
registerFirstUser: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
unlock: {
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
@@ -80,6 +88,7 @@ export interface Redirect {
|
||||
} | null;
|
||||
url?: string | null;
|
||||
};
|
||||
type: '301' | '302';
|
||||
customField?: string | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
|
||||
Reference in New Issue
Block a user