chore(form): 🗑️ remove unused form components and types
* Refactor Former components to streamline functionality * Update stories to reflect changes in form structure
This commit is contained in:
@@ -1,18 +1,24 @@
|
||||
import type { FormerAPICallType } from './Former.types';
|
||||
|
||||
function FormerRestHeadSpecAPI(options: {
|
||||
url: string;
|
||||
authToken: string;
|
||||
signal?: AbortSignal;
|
||||
fetchOptions?: Partial<RequestInit>;
|
||||
signal?: AbortSignal;
|
||||
url: string;
|
||||
}): FormerAPICallType {
|
||||
return async (mode, request, value, key) => {
|
||||
const baseUrl = options.url ?? ''; // Remove trailing slashes
|
||||
let url = baseUrl;
|
||||
let fetchOptions: RequestInit = {
|
||||
const fetchOptions: RequestInit = {
|
||||
cache: 'no-cache',
|
||||
signal: options.signal,
|
||||
...options.fetchOptions,
|
||||
body: mode === 'mutate' && request !== 'delete' ? JSON.stringify(value) : undefined,
|
||||
headers: {
|
||||
Authorization: `Bearer ${options.authToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
...options.fetchOptions?.headers,
|
||||
},
|
||||
method:
|
||||
mode === 'read'
|
||||
? 'GET'
|
||||
@@ -21,12 +27,6 @@ function FormerRestHeadSpecAPI(options: {
|
||||
: request === 'update'
|
||||
? 'PUT'
|
||||
: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${options.authToken}`,
|
||||
...options.fetchOptions?.headers,
|
||||
},
|
||||
body: mode === 'mutate' && request !== 'delete' ? JSON.stringify(value) : undefined,
|
||||
};
|
||||
|
||||
if (request !== 'insert') {
|
||||
|
||||
Reference in New Issue
Block a user