Skip to content

Commit

Permalink
added checks parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ANKUR DWIVEDI authored and ANKUR DWIVEDI committed Jul 31, 2024
1 parent 0048fb9 commit f3ef08a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ To use the SDK, you need to provide it with a few configuration parameters. The
}
]
}"
[checks]="'\'request.folder\' : \'sample-folder/\''" // To run server side checks before uploading files. Notice the quotes around request.folder and sample-folder.
></ik-upload>
```

Expand Down
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagekitio-angular",
"version": "5.0.0",
"version": "5.1.0",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down
2 changes: 1 addition & 1 deletion sdk/projects/imagekitio-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagekitio-angular",
"version": "5.0.0",
"version": "5.1.0",
"peerDependencies": {
"@angular/common": ">=12.2.0",
"@angular/core": ">=12.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class IkUploadComponent implements AfterViewInit {
@Input('onUploadStart') onUploadStart: (e: HTMLInputEvent) => void;
@Input('onUploadProgress') onUploadProgress: (e: ProgressEvent) => void;
@Input('transformation') transformation: Object; //optional
@Input('checks') checks: string; //optional
fileToUpload: File = null;
xhr: XMLHttpRequest;

Expand Down Expand Up @@ -76,6 +77,7 @@ export class IkUploadComponent implements AfterViewInit {
onError: this.onError,
onSuccess: this.onSuccess,
transformation: this.transformation,
checks: this.checks
}

// Custom validation
Expand Down Expand Up @@ -250,6 +252,11 @@ export class IkUploadComponent implements AfterViewInit {
if (options.transformation !== undefined) {
Object.assign(params, { transformation: options.transformation });
}

if (options.checks !== undefined) {
Object.assign(params, { checks: options.checks });
}

return params;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import ImageKit from 'imagekit-javascript';
const SDK_VERSION = '5.0.0';
const SDK_VERSION = '5.1.0';
export interface Lqip {
readonly active: boolean;
readonly quality: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface IkUploadComponentOptions {
validateFile?: Function;
xhr?: XMLHttpRequest;
transformation?: Object;
checks?: string;
}

export interface AuthResponse {
Expand Down
1 change: 1 addition & 0 deletions sdk/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ <h1>Hi! This is an ImageKit Angular SDK Demo!</h1>
[onUploadStart]="onUploadStartFunction"
[onUploadProgress]="onUploadProgressFunction"
[authenticator]="authenticator"
[checks]="'\'request.folder\' : \'sample-folder/\''"
class="file-upload-ik">
</ik-upload>
<button (click)="onAbortFunction()">Abort</button>
Expand Down

0 comments on commit f3ef08a

Please sign in to comment.