Complete instant diplomacy response parity
This commit is contained in:
@@ -235,6 +235,26 @@ export const useMainDashboardStore = defineStore('mainDashboard', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const respondToMessage = async (messageId: number, response: boolean) => {
|
||||
const id = generalId.value;
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const result = await trpc.messages.respond.mutate({
|
||||
generalId: id,
|
||||
messageId,
|
||||
response,
|
||||
});
|
||||
if (!result.result) {
|
||||
error.value = result.reason;
|
||||
}
|
||||
await refreshMessages();
|
||||
} catch (err) {
|
||||
error.value = resolveErrorMessage(err);
|
||||
}
|
||||
};
|
||||
|
||||
const setGeneralTurn = async (turnIndex: number, action: string) => {
|
||||
const id = generalId.value;
|
||||
if (!id) {
|
||||
@@ -311,7 +331,6 @@ export const useMainDashboardStore = defineStore('mainDashboard', () => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
let realtimeSource: EventSource | null = null;
|
||||
let realtimeToken: string | null = null;
|
||||
|
||||
@@ -472,6 +491,7 @@ export const useMainDashboardStore = defineStore('mainDashboard', () => {
|
||||
refreshMessages,
|
||||
sendMessage,
|
||||
loadOlderMessages,
|
||||
respondToMessage,
|
||||
setGeneralTurn,
|
||||
shiftGeneralTurns,
|
||||
setNationTurn,
|
||||
|
||||
Reference in New Issue
Block a user