mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
send created redirect
This commit is contained in:
@@ -135,11 +135,12 @@ export class SendApiService implements SendApiServiceAbstraction {
|
||||
return this.apiService.send("DELETE", "/sends/" + id, null, true, false);
|
||||
}
|
||||
|
||||
async save(sendData: [Send, EncArrayBuffer]): Promise<any> {
|
||||
async save(sendData: [Send, EncArrayBuffer]): Promise<SendData> {
|
||||
const response = await this.upload(sendData);
|
||||
|
||||
const data = new SendData(response);
|
||||
await this.sendService.upsert(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<any> {
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||
@@ -186,6 +187,7 @@ export class SendFormComponent implements AfterViewInit, OnInit, OnChanges, Send
|
||||
private addEditFormService: SendFormService,
|
||||
private toastService: ToastService,
|
||||
private i18nService: I18nService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
submit = async () => {
|
||||
@@ -195,18 +197,24 @@ export class SendFormComponent implements AfterViewInit, OnInit, OnChanges, Send
|
||||
}
|
||||
|
||||
// TODO: Add file handling
|
||||
await this.addEditFormService.saveSend(this.updatedSendView, null, this.config);
|
||||
const sendView = await this.addEditFormService.saveSend(
|
||||
this.updatedSendView,
|
||||
null,
|
||||
this.config,
|
||||
);
|
||||
|
||||
if (this.config.mode === "add") {
|
||||
await this.router.navigate(["/send-created"], {
|
||||
queryParams: { sendId: sendView.id },
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
message: this.i18nService.t(
|
||||
this.config.mode === "edit" || this.config.mode === "partial-edit"
|
||||
? "editedItem"
|
||||
: "addedItem",
|
||||
),
|
||||
message: this.i18nService.t("editedItem"),
|
||||
});
|
||||
|
||||
this.sendSaved.emit(this.updatedSendView);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user